@@ -1,12 +1,13 @@
11-- This header file was generated by ./256colres.pl
22module Graphics.Vty.Attributes.Color240
33 ( rgbColor
4− , color240ToRGB
4+ , color240CodeToRGB
55 )
66where
77
88import Graphics.Vty.Attributes.Color
99
10+import Data.Word (Word8)
1011import Text.Printf
1112
1213-- Note: rgbColor's mapping from RGB to 240 colors was generated from
@@ -263,10 +264,9 @@ rgbColor r g b
263264 (fromIntegral g :: Int)
264265 (fromIntegral b :: Int))
265266
266−-- | Create a RGB triple from a Vty 'Color' (in the 240 color set). Error if Color is not
267−-- a Color240.
268−color240ToRGB :: Color -> (Int, Int, Int)
269−color240ToRGB (Color240 n) = case n of
267+-- | Create a RGB triple from a value in the Color240 set.
268+color240CodeToRGB :: Word8 -> (Int, Int, Int)
269+color240CodeToRGB n = case n of
270270 0 -> (0, 0, 0)
271271 1 -> (0, 0, 95)
272272 2 -> (0, 0, 135)
@@ -507,5 +507,4 @@ color240ToRGB (Color240 n) = case n of
507507 237 -> (218, 218, 218)
508508 238 -> (228, 228, 228)
509509 239 -> (238, 238, 238)
510− _ -> error (printf "Color240 %d is invalid." n)
511−color240ToRGB _ = error "tried to map non-Color240 to RGB"
510+ _ -> error (printf "Color240 value %d is invalid." n)