Skip to content

Commit

Permalink
Conform Color to View
Browse files Browse the repository at this point in the history
  • Loading branch information
danielctull committed Dec 14, 2024
1 parent ab503a4 commit 1151a0e
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@

public struct Color: CustomStringConvertible, Equatable, Sendable {
public struct Color: Builtin, CustomStringConvertible, Equatable, Sendable, View {
public let description: String
let foreground: ControlSequence
let background: ControlSequence

func render(in canvas: any Canvas, size: Size, environment: EnvironmentValues) {
let pixel = Pixel(" ", background: self)
for x in 1...size.width {
for y in 1...size.height {
canvas.draw(pixel, at: Position(x: x, y: y))
}
}
}
}

// MARK: - ANSI colors
Expand Down

0 comments on commit 1151a0e

Please sign in to comment.