diff options
| author | bptato <nincsnevem662@gmail.com> | 2024-11-15 17:33:38 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2024-11-15 17:33:57 +0100 |
| commit | e94dae5d8aba469876a40d6400332c674189d126 (patch) | |
| tree | 15f640681c63b18043a969ca4515f63537041d4d /src | |
| parent | 040c960a2788bef9910eee0a3c98cef7890f9d23 (diff) | |
| download | chawan-e94dae5d8aba469876a40d6400332c674189d126.tar.gz | |
color: clean up dead code
Diffstat (limited to 'src')
| -rw-r--r-- | src/types/color.nim | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/types/color.nim b/src/types/color.nim index 7e9d9d8d..f78b3e28 100644 --- a/src/types/color.nim +++ b/src/types/color.nim @@ -379,18 +379,12 @@ func rgba*(r, g, b, a: uint8): ARGBColor = func rgba_be*(r, g, b, a: uint8): RGBAColorBE = return RGBAColorBE(r: r, g: g, b: b, a: a) -func rgb_be*(r, g, b: uint8): RGBAColorBE = - return RGBAColorBE(r: r, g: g, b: b, a: 0xFF) - func rgba*(r, g, b, a: int): ARGBColor = return rgba(uint8(r), uint8(g), uint8(b), uint8(a)) func gray*(n: uint8): RGBColor = return rgb(n, n, n) -func gray_be*(n: uint8): RGBAColorBE = - return rgb_be(n, n, n) - # NOTE: this assumes n notin 0..15 (which would be ANSI 4-bit) func toRGB*(param0: ANSIColor): RGBColor = doAssert uint8(param0) notin 0u8..15u8 @@ -407,10 +401,10 @@ func toRGB*(param0: ANSIColor): RGBColor = let n = (u - 232) * 10 + 8 return gray(n) -func toEightBit(r, g, b: uint8): ANSIColor = - let r = int(r) - let g = int(g) - let b = int(b) +func toEightBit*(c: RGBColor): ANSIColor = + let r = int(c.r) + let g = int(c.g) + let b = int(c.b) # Idea from here: https://github.com/Qix-/color-convert/pull/75 # This seems to work about as well as checking for # abs(U - 128) < 5 & abs(V - 128 < 5), but is definitely faster. @@ -424,12 +418,6 @@ func toEightBit(r, g, b: uint8): ANSIColor = return ANSIColor(uint8(16 + 36 * (r * 5 div 255) + 6 * (g * 5 div 255) + (b * 5 div 255))) -func toEightBit*(c: RGBColor): ANSIColor = - return toEightBit(c.r, c.g, c.b) - -func toEightBit*(c: RGBAColorBE): ANSIColor = - return toEightBit(c.r, c.g, c.b) - template `$`*(color: CellColor): string = case color.t of ctNone: "none" |