In CosPlay, a pixel is a single character defined by CPPixel class. Character-pixel is a fundamental graphics unit in ASCII-based games. Just like the raster pixel on a graphics screen it represents the smallest area that can be rendered on the screen:
Note that pixel itself does not have a Z-index as it can be rendered at any Z-index.
Pixel creation and manipulation is used extensively throughout a CosPlay game. There are several ways you can create a pixel:
You can use various CPPixel constructors directly:
import org.cosplay.* import CPColor.* import CPPixel.* // Canonical black 'x' on white background. new CPPixel('x', C_BLACK, Some(C_WHITE), 0) // Few companion object shortcuts for often used cases... CPPixel('x', C_BLACK, C_WHITE) // Avoiding 'Some'. CPPixel('x', C_BLACK) // Skipping background all together. CPPixel('x', C_BLACK, 2) // Skipping background & setting a '2' ag. CPPixel('x', C_BLACK, C_WHITE, 2) // Setting up a '2' tag.
You can also use a convenient syntactic sugar &
and &&
based on extension of Char
type. The following unit test demonstrates that usage (line 5 and line 19). Note that usage of &
and &&
extension operators is the recommended way and that is what is used internally by CosPlay:
import org.cosplay.* import CPColor.* import CPPixel.* val p1 = 'x'&C_BLACK // Recommended way. val p2 = CPPixel('x', C_BLACK) val p3 = new CPPixel('x', C_BLACK, None, 0) assertTrue(p1 == p2) assertTrue(p2 == p3) val p6 = 'x'&&(C_BLACK, C_WHITE) // Recommended way. val p7 = new CPPixel('x', C_BLACK, Option(C_WHITE), 0) assertTrue(p6 == p7)
&
and &&
extension operator is the recommended way to create pixels:val px1 = 'x'&C_BLACK // Without background color. val px2 = 'x'&&(C_BLACK, C_WHITE) // With background color.
Since the pixel itself is immutable, to modify it you can use the following cloning methods:
val p1 = 'x'&C_BLACK val p2 = p1.withFg(C_BLUE) // New pixel clone with given foreground. val p3 = p1.withBg(Option(C_HOT_PINK))) // New pixel clone with given background. val p4 = p1.withFgBg(C_BLUE, Option(C_HOT_PINK))) // Combines two above. val p5 = p1.withChar('z') // New pixel clone with given character. val p6 = p1.toLower // New pixel clone with character converted to lower case. val p7 = p1.toUpper // New pixel clone with character converted to upper case. val p8 = p1.withTag(10) // New pixel clone with given tag.
In CosPlay, a color is defined by CPColor class:
CPColor companion object provides 100s of the pre-built color constants for all xterm and X11 standard colors. New color creation is an expensive process. It is highly recommended using one of the many built-in color constants or pre-create the colors you need upfront. As a rule of thumb - avoid new color creation on each frame update.
New colors can be created in the following ways:
val c1 = CPColor(0, 128, 0) // RGB values. val c2 = CPColor("0x008000") // Hexadecimal RGB. val c3 = CPColor("#008000") // CSS-style hexadecimal RGB. assert(c1 == c2) assert(c2 == c3)
Since the color itself is immutable, to modify it you can use the following methods:
val c = CPColor(32, 64, 128) val c1 = c.bw() // B&W clone. val c2 = c.bw() // Another B&W clone for lighter green and deeper blues. val c3 = c.awt // Standard AWT colors. val c4 = c.bgAnsi // ANSI background color sequence. val c5 = c.fgAnsi // ANSI foreground color sequence. val c6 = c.darker(0.5) // 50% darker clone. val c7 = c.lighter(0.5) // 50% lighter clone. val c8 = c.transform(0.2, 0.8, 0.5) // RGB-transformed clone. val c9 = c.color8Bit // 8-bit translation clone. // Gradient 20-step function between two colors. val f1 = CPColor.gradientFun(C_WHITE, C_BLACK, 20) // Gradient 20-step sequence between two colors. val s1 = CPColor.gradientSeq(C_WHITE, C_BLACK, 20)
Most modern ANSI terminals support "True Color" 24-bit colors, the unlimited combination of Red, Green, and Blue values in RGB. Some older terminals, however, only provide support for 8-bit colors where each color is a lookup number into 256-color lookup table (LUT). These are also often called xterm colors despite the fact that xterm terminal application does support the 24-bit colors. Note that there's only an approximate translation from a true 24-bit color to 8-bit color, i.e. the closest 8-bit color will be used when translating from 24-bit color to 8-bit color. More specifically, many darker 24-bit colors will convert as 8-bit dark grey.
By default, CosPlay stores all colors in 24-bit format internally and renders all colors as 24-bit colors in both native terminal and the built-in terminal emulator. If, however, you want to automatically convert 24-bit color to the nearest 8-bit color during rendering you need to set JVM system property COSPLAY_FORCE_8BIT_COLOR=true
. Note that this will force both native terminal and built-in terminal emulator to use 8-bit color conversion even though technically the built-in terminal emulator can always display true 24-bit color. This is only necessary if running the game in the native terminal that does not support 24-bit colors.
Note also that since 8-bit color space is much smaller many color effects like fade in and fade out, color gradients, etc. will look less smooth when using 8-bit colors.
CPColor companion object provides constants for pre-built colors:
C_
represent colors in xterm naming convention.C_X11_
represent colors in X11 color naming convention.CS_X11_
represent colors grouped by the primary color in X11 color naming convention.You are free to use any constants with any naming convention, as well as mix and match - they are all just colors. Note that although there are many similar and identical colors across two naming groups, they do differ in some as well as offer some unique colors. CosPlay provides these two sets of constants for convenience. Please, refer to the following links for specific color references:
Here's the lookup table for built-in xterm colors:
Color | RGB Value | |
---|---|---|
C_GREY0 | r: 0 g: 0 b: 0 #000000 | |
C_NAVY_BLUE | r: 0 g: 0 b: 95 #00005F | |
C_DARK_BLUE | r: 0 g: 0 b: 135 #000087 | |
C_BLUE3 | r: 0 g: 0 b: 175 #0000AF | |
C_BLUE31 | r: 0 g: 0 b: 215 #0000D7 | |
C_BLUE1 | r: 0 g: 0 b: 255 #0000FF | |
C_DARK_GREEN | r: 0 g: 95 b: 0 #005F00 | |
C_STEEL_BLUE14 | r: 0 g: 95 b: 95 #005F5F | |
C_STEEL_BLUE14A | r: 0 g: 95 b: 135 #005F87 | |
C_STEEL_BLUE14B | r: 0 g: 95 b: 175 #005FAF | |
C_DODGER_BLUE3 | r: 0 g: 95 b: 215 #005FD7 | |
C_DODGER_BLUE2 | r: 0 g: 95 b: 255 #005FFF | |
C_GREEN4 | r: 0 g: 135 b: 0 #008700 | |
C_SPRING_GREEN4 | r: 0 g: 135 b: 95 #00875F | |
C_TURQUOISE4 | r: 0 g: 135 b: 135 #008787 | |
C_STEEL_BLUE13 | r: 0 g: 135 b: 175 #0087AF | |
C_STEEL_BLUE13A | r: 0 g: 135 b: 215 #0087D7 | |
C_DODGER_BLUE1 | r: 0 g: 135 b: 255 #0087FF | |
C_GREEN3 | r: 0 g: 175 b: 0 #00AF00 | |
C_SPRING_GREEN3 | r: 0 g: 175 b: 95 #00AF5F | |
C_DARK_CYAN | r: 0 g: 175 b: 135 #00AF87 | |
C_LIGHT_SEA_GREEN | r: 0 g: 175 b: 175 #00AFAF | |
C_STEEL_BLUE12 | r: 0 g: 175 b: 215 #00AFD7 | |
C_STEEL_BLUE11 | r: 0 g: 175 b: 255 #00AFFF | |
C_GREEN3A | r: 0 g: 215 b: 0 #00D700 | |
C_SPRING_GREEN3A | r: 0 g: 215 b: 95 #00D75F | |
C_SPRING_GREEN2 | r: 0 g: 215 b: 135 #00D787 | |
C_CYAN3 | r: 0 g: 215 b: 175 #00D7AF | |
C_DARK_TURQUOISE | r: 0 g: 215 b: 215 #00D7D7 | |
C_TURQUOISE2 | r: 0 g: 215 b: 255 #00D7FF | |
C_GREEN1 | r: 0 g: 255 b: 0 #00FF00 | |
C_SPRING_GREEN2A | r: 0 g: 255 b: 95 #00FF5F | |
C_SPRING_GREEN1 | r: 0 g: 255 b: 135 #00FF87 | |
C_MEDIUM_SPRING_GREEN | r: 0 g: 255 b: 175 #00FFAF | |
C_CYAN2 | r: 0 g: 255 b: 215 #00FFD7 | |
C_CYAN1 | r: 0 g: 255 b: 255 #00FFFF | |
C_GREY3 | r: 8 g: 8 b: 8 #080808 | |
C_GREY7 | r: 18 g: 18 b: 18 #121212 | |
C_GREY11 | r: 28 g: 28 b: 28 #1C1C1C | |
C_GREY15 | r: 38 g: 38 b: 38 #262626 | |
C_GREY19 | r: 48 g: 48 b: 48 #303030 | |
C_GREY23 | r: 58 g: 58 b: 58 #3A3A3A | |
C_GREY27 | r: 68 g: 68 b: 68 #444444 | |
C_GREY30 | r: 78 g: 78 b: 78 #4E4E4E | |
C_GREY35 | r: 88 g: 88 b: 88 #585858 | |
C_DARK_RED | r: 95 g: 0 b: 0 #5F0000 | |
C_DEEP_PINK4 | r: 95 g: 0 b: 95 #5F005F | |
C_PURPLE4 | r: 95 g: 0 b: 135 #5F0087 | |
C_PURPLE4A | r: 95 g: 0 b: 175 #5F00AF | |
C_PURPLE3 | r: 95 g: 0 b: 215 #5F00D7 | |
C_BLUE_VIOLET | r: 95 g: 0 b: 255 #5F00FF | |
C_ORANGE4 | r: 95 g: 95 b: 0 #5F5F00 | |
C_GREY37 | r: 95 g: 95 b: 95 #5F5F5F | |
C_MEDIUM_PURPLE34 | r: 95 g: 95 b: 135 #5F5F87 | |
C_SLATE_BLUE3 | r: 95 g: 95 b: 175 #5F5FAF | |
C_SLATE_BLUE3A | r: 95 g: 95 b: 215 #5F5FD7 | |
C_ROYAL_BLUE1 | r: 95 g: 95 b: 255 #5F5FFF | |
C_CHARTREUSE4 | r: 95 g: 135 b: 0 #5F8700 | |
C_DARK_SEA_GREEN4 | r: 95 g: 135 b: 95 #5F875F | |
C_PALE_TURQUOISE4 | r: 95 g: 135 b: 135 #5F8787 | |
C_STEEL_BLUE | r: 95 g: 135 b: 175 #5F87AF | |
C_STEEL_BLUE3 | r: 95 g: 135 b: 215 #5F87D7 | |
C_CORNFLOWER_BLUE | r: 95 g: 135 b: 255 #5F87FF | |
C_CHARTREUSE3 | r: 95 g: 175 b: 0 #5FAF00 | |
C_DARK_SEA_GREEN4A | r: 95 g: 175 b: 95 #5FAF5F | |
C_CADET_BLUE | r: 95 g: 175 b: 135 #5FAF87 | |
C_CADET_BLUE1 | r: 95 g: 175 b: 175 #5FAFAF | |
C_SKY_BLUE1 | r: 95 g: 175 b: 215 #5FAFD7 | |
C_STEEL_BLUE1 | r: 95 g: 175 b: 255 #5FAFFF | |
C_CHARTREUSE3A | r: 95 g: 215 b: 0 #5FD700 | |
C_PALE_GREEN3 | r: 95 g: 215 b: 95 #5FD75F | |
C_SEA_GREEN3 | r: 95 g: 215 b: 135 #5FD787 | |
C_AQUAMARINE3 | r: 95 g: 215 b: 175 #5FD7AF | |
C_MEDIUM_TURQUOISE | r: 95 g: 215 b: 215 #5FD7D7 | |
C_STEEL_BLUE1A | r: 95 g: 215 b: 255 #5FD7FF | |
C_CHARTREUSE2 | r: 95 g: 255 b: 0 #5FFF00 | |
C_SEA_GREEN2 | r: 95 g: 255 b: 95 #5FFF5F | |
C_SEA_GREEN1 | r: 95 g: 255 b: 135 #5FFF87 | |
C_SEA_GREEN1A | r: 95 g: 255 b: 175 #5FFFAF | |
C_AQUAMARINE1 | r: 95 g: 255 b: 215 #5FFFD7 | |
C_DARK_SLATE_GRAY2 | r: 95 g: 255 b: 255 #5FFFFF | |
C_GREY39 | r: 98 g: 98 b: 98 #626262 | |
C_GREY42 | r: 108 g: 108 b: 108 #6C6C6C | |
C_GREY46 | r: 118 g: 118 b: 118 #767676 | |
C_GREY50 | r: 128 g: 128 b: 128 #808080 | |
C_DARK_RED1 | r: 135 g: 0 b: 0 #870000 | |
C_DEEP_PINK4A | r: 135 g: 0 b: 95 #87005F | |
C_DARK_MAGENTA | r: 135 g: 0 b: 135 #870087 | |
C_DARK_MAGENTA1 | r: 135 g: 0 b: 175 #8700AF | |
C_DARK_VIOLET | r: 135 g: 0 b: 215 #8700D7 | |
C_PURPLE1 | r: 135 g: 0 b: 255 #8700FF | |
C_ORANGE4A | r: 135 g: 95 b: 0 #875F00 | |
C_LIGHT_PINK4 | r: 135 g: 95 b: 95 #875F5F | |
C_PLUM4 | r: 135 g: 95 b: 135 #875F87 | |
C_MEDIUM_PURPLE33 | r: 135 g: 95 b: 175 #875FAF | |
C_MEDIUM_PURPLE33A | r: 135 g: 95 b: 215 #875FD7 | |
C_SLATE_BLUE1 | r: 135 g: 95 b: 255 #875FFF | |
C_YELLOW4 | r: 135 g: 135 b: 0 #878700 | |
C_WHEAT4 | r: 135 g: 135 b: 95 #87875F | |
C_GREY53 | r: 135 g: 135 b: 135 #878787 | |
C_LIGHT_SLATE_GREY | r: 135 g: 135 b: 175 #8787AF | |
C_MEDIUM_PURPLE3 | r: 135 g: 135 b: 215 #8787D7 | |
C_LIGHT_SLATE_BLUE | r: 135 g: 135 b: 255 #8787FF | |
C_YELLOW4A | r: 135 g: 175 b: 0 #87AF00 | |
C_DARK_OLIVE_GREEN3 | r: 135 g: 175 b: 95 #87AF5F | |
C_DARK_SEA_GREEN | r: 135 g: 175 b: 135 #87AF87 | |
C_LIGHT_SKY_BLUE3 | r: 135 g: 175 b: 175 #87AFAF | |
C_LIGHT_SKY_BLUE3A | r: 135 g: 175 b: 215 #87AFD7 | |
C_SKY_BLUE12 | r: 135 g: 175 b: 255 #87AFFF | |
C_CHARTREUSE2A | r: 135 g: 215 b: 0 #87D700 | |
C_DARK_OLIVE_GREEN3A | r: 135 g: 215 b: 95 #87D75F | |
C_PALE_GREEN3A | r: 135 g: 215 b: 135 #87D787 | |
C_DARK_SEA_GREEN3 | r: 135 g: 215 b: 175 #87D7AF | |
C_DARK_SLATE_GRAY3 | r: 135 g: 215 b: 215 #87D7D7 | |
C_SKY_BLUE11 | r: 135 g: 215 b: 255 #87D7FF | |
C_CHARTREUSE1 | r: 135 g: 255 b: 0 #87FF00 | |
C_LIGHT_GREEN | r: 135 g: 255 b: 95 #87FF5F | |
C_LIGHT_GREEN1 | r: 135 g: 255 b: 135 #87FF87 | |
C_PALE_GREEN1 | r: 135 g: 255 b: 175 #87FFAF | |
C_AQUAMARINE1A | r: 135 g: 255 b: 215 #87FFD7 | |
C_DARK_SLATE_GRAY1 | r: 135 g: 255 b: 255 #87FFFF | |
C_GREY54 | r: 138 g: 138 b: 138 #8A8A8A | |
C_GREY58 | r: 148 g: 148 b: 148 #949494 | |
C_GREY62 | r: 158 g: 158 b: 158 #9E9E9E | |
C_GREY66 | r: 168 g: 168 b: 168 #A8A8A8 | |
C_RED3 | r: 175 g: 0 b: 0 #AF0000 | |
C_DEEP_PINK4B | r: 175 g: 0 b: 95 #AF005F | |
C_MEDIUM_VIOLET_RED | r: 175 g: 0 b: 135 #AF0087 | |
C_MAGENTA3 | r: 175 g: 0 b: 175 #AF00AF | |
C_DARK_VIOLET1 | r: 175 g: 0 b: 215 #AF00D7 | |
C_PURPLE2 | r: 175 g: 0 b: 255 #AF00FF | |
C_DARK_ORANGE3 | r: 175 g: 95 b: 0 #AF5F00 | |
C_INDIAN_RED | r: 175 g: 95 b: 95 #AF5F5F | |
C_HOT_PINK3 | r: 175 g: 95 b: 135 #AF5F87 | |
C_MEDIUM_ORCHID3 | r: 175 g: 95 b: 175 #AF5FAF | |
C_MEDIUM_ORCHID | r: 175 g: 95 b: 215 #AF5FD7 | |
C_MEDIUM_PURPLE32 | r: 175 g: 95 b: 255 #AF5FFF | |
C_DARK_GOLDEN_ROD | r: 175 g: 135 b: 0 #AF8700 | |
C_LIGHT_SALMON3 | r: 175 g: 135 b: 95 #AF875F | |
C_ROSY_BROWN | r: 175 g: 135 b: 135 #AF8787 | |
C_GREY63 | r: 175 g: 135 b: 175 #AF87AF | |
C_MEDIUM_PURPLE32A | r: 175 g: 135 b: 215 #AF87D7 | |
C_MEDIUM_PURPLE31 | r: 175 g: 135 b: 255 #AF87FF | |
C_GOLD3 | r: 175 g: 175 b: 0 #AFAF00 | |
C_DARK_KHAKI | r: 175 g: 175 b: 95 #AFAF5F | |
C_NAVAJO_WHITE3 | r: 175 g: 175 b: 135 #AFAF87 | |
C_GREY69 | r: 175 g: 175 b: 175 #AFAFAF | |
C_LIGHT_STEEL_BLUE3 | r: 175 g: 175 b: 215 #AFAFD7 | |
C_LIGHT_STEEL_BLUE | r: 175 g: 175 b: 255 #AFAFFF | |
C_YELLOW3 | r: 175 g: 215 b: 0 #AFD700 | |
C_DARK_OLIVE_GREEN3B | r: 175 g: 215 b: 95 #AFD75F | |
C_DARK_SEA_GREEN3A | r: 175 g: 215 b: 135 #AFD787 | |
C_DARK_SEA_GREEN2 | r: 175 g: 215 b: 175 #AFD7AF | |
C_LIGHT_CYAN3 | r: 175 g: 215 b: 215 #AFD7D7 | |
C_LIGHT_SKYBLUE1 | r: 175 g: 215 b: 255 #AFD7FF | |
C_GREEN_YELLOW | r: 175 g: 255 b: 0 #AFFF00 | |
C_DARK_OLIVE_GREEN2 | r: 175 g: 255 b: 95 #AFFF5F | |
C_PALE_GREEN1A | r: 175 g: 255 b: 135 #AFFF87 | |
C_DARK_SEA_GREEN2A | r: 175 g: 255 b: 175 #AFFFAF | |
C_DARK_SEA_GREEN1 | r: 175 g: 255 b: 215 #AFFFD7 | |
C_PALE_TURQUOISE1 | r: 175 g: 255 b: 255 #AFFFFF | |
C_GREY70 | r: 178 g: 178 b: 178 #B2B2B2 | |
C_GREY74 | r: 188 g: 188 b: 188 #BCBCBC | |
C_GREY78 | r: 198 g: 198 b: 198 #C6C6C6 | |
C_GREY82 | r: 208 g: 208 b: 208 #D0D0D0 | |
C_RED3A | r: 215 g: 0 b: 0 #D70000 | |
C_DEEP_PINK3 | r: 215 g: 0 b: 95 #D7005F | |
C_DEEP_PINK3A | r: 215 g: 0 b: 135 #D70087 | |
C_MAGENTA3A | r: 215 g: 0 b: 175 #D700AF | |
C_MAGENTA3B | r: 215 g: 0 b: 215 #D700D7 | |
C_MAGENTA2 | r: 215 g: 0 b: 255 #D700FF | |
C_DARK_ORANGE3A | r: 215 g: 95 b: 0 #D75F00 | |
C_INDIAN_RED1 | r: 215 g: 95 b: 95 #D75F5F | |
C_HOT_PINK3A | r: 215 g: 95 b: 135 #D75F87 | |
C_HOT_PINK2 | r: 215 g: 95 b: 175 #D75FAF | |
C_ORCHID | r: 215 g: 95 b: 215 #D75FD7 | |
C_MEDIUM_ORCHID1 | r: 215 g: 95 b: 255 #D75FFF | |
C_ORANGE3 | r: 215 g: 135 b: 0 #D78700 | |
C_LIGHT_SALMON3A | r: 215 g: 135 b: 95 #D7875F | |
C_LIGHT_PINK3 | r: 215 g: 135 b: 135 #D78787 | |
C_PINK3 | r: 215 g: 135 b: 175 #D787AF | |
C_PLUM3 | r: 215 g: 135 b: 215 #D787D7 | |
C_VIOLET | r: 215 g: 135 b: 255 #D787FF | |
C_GOLD3A | r: 215 g: 175 b: 0 #D7AF00 | |
C_LIGHT_GOLDEN_ROD3 | r: 215 g: 175 b: 95 #D7AF5F | |
C_TAN | r: 215 g: 175 b: 135 #D7AF87 | |
C_MISTY_ROSE3 | r: 215 g: 175 b: 175 #D7AFAF | |
C_THISTLE3 | r: 215 g: 175 b: 215 #D7AFD7 | |
C_PLUM2 | r: 215 g: 175 b: 255 #D7AFFF | |
C_YELLOW3A | r: 215 g: 215 b: 0 #D7D700 | |
C_KHAKI3 | r: 215 g: 215 b: 95 #D7D75F | |
C_LIGHT_GOLDEN_ROD2 | r: 215 g: 215 b: 135 #D7D787 | |
C_LIGHT_YELLOW3 | r: 215 g: 215 b: 175 #D7D7AF | |
C_GREY84 | r: 215 g: 215 b: 215 #D7D7D7 | |
C_LIGHT_STEEL_BLUE1 | r: 215 g: 215 b: 255 #D7D7FF | |
C_YELLOW2 | r: 215 g: 255 b: 0 #D7FF00 | |
C_DARK_OLIVE_GREEN1 | r: 215 g: 255 b: 95 #D7FF5F | |
C_DARK_OLIVE_GREEN1A | r: 215 g: 255 b: 135 #D7FF87 | |
C_DARK_SEA_GREEN1A | r: 215 g: 255 b: 175 #D7FFAF | |
C_HONEYDEW2 | r: 215 g: 255 b: 215 #D7FFD7 | |
C_LIGHT_CYAN1 | r: 215 g: 255 b: 255 #D7FFFF | |
C_GREY85 | r: 218 g: 218 b: 218 #DADADA | |
C_GREY89 | r: 228 g: 228 b: 228 #E4E4E4 | |
C_GREY93 | r: 238 g: 238 b: 238 #EEEEEE | |
C_RED1 | r: 255 g: 0 b: 0 #FF0000 | |
C_DEEP_PINK2 | r: 255 g: 0 b: 95 #FF005F | |
C_DEEP_PINK1 | r: 255 g: 0 b: 135 #FF0087 | |
C_DEEP_PINK1A | r: 255 g: 0 b: 175 #FF00AF | |
C_MAGENTA2A | r: 255 g: 0 b: 215 #FF00D7 | |
C_MAGENTA1 | r: 255 g: 0 b: 255 #FF00FF | |
C_ORANGE_RED1 | r: 255 g: 95 b: 0 #FF5F00 | |
C_INDIAN_RED1A | r: 255 g: 95 b: 95 #FF5F5F | |
C_INDIAN_RED1B | r: 255 g: 95 b: 135 #FF5F87 | |
C_HOT_PINK | r: 255 g: 95 b: 175 #FF5FAF | |
C_HOT_PINK1 | r: 255 g: 95 b: 215 #FF5FD7 | |
C_MEDIUM_ORCHID1A | r: 255 g: 95 b: 255 #FF5FFF | |
C_DARK_ORANGE | r: 255 g: 135 b: 0 #FF8700 | |
C_SALMON1 | r: 255 g: 135 b: 95 #FF875F | |
C_LIGHT_CORAL | r: 255 g: 135 b: 135 #FF8787 | |
C_HOT_PINK31 | r: 255 g: 135 b: 175 #FF87AF | |
C_ORCHID2 | r: 255 g: 135 b: 215 #FF87D7 | |
C_ORCHID1 | r: 255 g: 135 b: 255 #FF87FF | |
C_ORANGE1 | r: 255 g: 175 b: 0 #FFAF00 | |
C_SANDY_BROWN | r: 255 g: 175 b: 95 #FFAF5F | |
C_LIGHT_SALMON1 | r: 255 g: 175 b: 135 #FFAF87 | |
C_LIGHT_PINK1 | r: 255 g: 175 b: 175 #FFAFAF | |
C_PINK1 | r: 255 g: 175 b: 215 #FFAFD7 | |
C_PLUM1 | r: 255 g: 175 b: 255 #FFAFFF | |
C_GOLD1 | r: 255 g: 215 b: 0 #FFD700 | |
C_LIGHT_GOLDEN_ROD2B | r: 255 g: 215 b: 95 #FFD75F | |
C_LIGHT_GOLDEN_ROD2A | r: 255 g: 215 b: 135 #FFD787 | |
C_NAVAJO_WHITE1 | r: 255 g: 215 b: 175 #FFD7AF | |
C_MISTY_ROSE1 | r: 255 g: 215 b: 215 #FFD7D7 | |
C_THISTLE1 | r: 255 g: 215 b: 255 #FFD7FF | |
C_YELLOW1 | r: 255 g: 255 b: 0 #FFFF00 | |
C_LIGHT_GOLDEN_ROD1 | r: 255 g: 255 b: 95 #FFFF5F | |
C_KHAKI1 | r: 255 g: 255 b: 135 #FFFF87 | |
C_WHEAT1 | r: 255 g: 255 b: 175 #FFFFAF | |
C_CORN_SILK1 | r: 255 g: 255 b: 215 #FFFFD7 | |
C_GREY100 | r: 255 g: 255 b: 255 #FFFFFF |
Here's the lookup table for built-in X11 colors:
Color | RGB Value | |
---|---|---|
C_X11_ALICE_BLUE | r: 240 g: 248 b: 255 #F0F8FF | |
C_X11_HONEY_DEW | r: 240 g: 255 b: 240 #F0FFF0 | |
C_X11_AZURE | r: 240 g: 255 b: 255 #F0FFFF | |
C_X11_BEIGE | r: 245 g: 245 b: 220 #F5F5DC | |
C_X11_WHITE_SMOKE | r: 245 g: 245 b: 245 #F5F5F5 | |
C_X11_MINT_CREAM | r: 245 g: 255 b: 250 #F5FFFA | |
C_X11_GHOST_WHITE | r: 248 g: 248 b: 255 #F8F8FF | |
C_X11_ANTIQUE_WHITE | r: 250 g: 235 b: 215 #FAEBD7 | |
C_X11_LINEN | r: 250 g: 240 b: 230 #FAF0E6 | |
C_X11_OLD_LACE | r: 253 g: 245 b: 230 #FDF5E6 | |
C_X11_MISTY_ROSE | r: 255 g: 228 b: 225 #FFE4E1 | |
C_X11_LAVENDER_BLUSH | r: 255 g: 240 b: 245 #FFF0F5 | |
C_X11_SEA_SHELL | r: 255 g: 245 b: 238 #FFF5EE | |
C_X11_FLORAL_WHITE | r: 255 g: 250 b: 240 #FFFAF0 | |
C_X11_SNOW | r: 255 g: 250 b: 250 #FFFAFA | |
C_X11_IVORY | r: 255 g: 255 b: 240 #FFFFF0 | |
C_X11_WHITE | r: 255 g: 255 b: 255 #FFFFFF | |
C_X11_TEAL | r: 0 g: 128 b: 128 #008080 | |
C_X11_DARK_CYAN | r: 0 g: 139 b: 139 #008B8B | |
C_X11_DARK_TURQUOISE | r: 0 g: 206 b: 209 #00CED1 | |
C_X11_CYAN | r: 0 g: 255 b: 255 #00FFFF | |
C_X11_AQUA | r: 0 g: 255 b: 255 #00FFFF | |
C_X11_LIGHT_SEA_GREEN | r: 32 g: 178 b: 170 #20B2AA | |
C_X11_TURQUOISE | r: 64 g: 224 b: 208 #40E0D0 | |
C_X11_MEDIUM_TURQUOISE | r: 72 g: 209 b: 204 #48D1CC | |
C_X11_CADET_BLUE | r: 95 g: 158 b: 160 #5F9EA0 | |
C_X11_MEDIUM_AQUAMARINE | r: 102 g: 205 b: 170 #66CDAA | |
C_X11_AQUAMARINE | r: 127 g: 255 b: 212 #7FFFD4 | |
C_X11_PALE_TURQUOISE | r: 175 g: 238 b: 238 #AFEEEE | |
C_X11_LIGHT_CYAN | r: 224 g: 255 b: 255 #E0FFFF | |
C_X11_ORANGE_RED | r: 255 g: 69 b: 0 #FF4500 | |
C_X11_TOMATO | r: 255 g: 99 b: 71 #FF6347 | |
C_X11_CORAL | r: 255 g: 127 b: 80 #FF7F50 | |
C_X11_DARK_ORANGE | r: 255 g: 140 b: 0 #FF8C00 | |
C_X11_ORANGE | r: 255 g: 165 b: 0 #FFA500 | |
C_X11_GOLD | r: 255 g: 215 b: 0 #FFD700 | |
C_X11_DARK_KHAKI | r: 189 g: 183 b: 107 #BDB76B | |
C_X11_PALE_GOLDEN_ROD | r: 238 g: 232 b: 170 #EEE8AA | |
C_X11_KHAKI | r: 240 g: 230 b: 140 #F0E68C | |
C_X11_LIGHT_GOLDEN_ROD_YELLOW | r: 250 g: 250 b: 210 #FAFAD2 | |
C_X11_PEACH_PUFF | r: 255 g: 218 b: 185 #FFDAB9 | |
C_X11_MOCCASIN | r: 255 g: 228 b: 181 #FFE4B5 | |
C_X11_PAPAYA_WHIP | r: 255 g: 239 b: 213 #FFEFD5 | |
C_X11_LEMON_CHIFFON | r: 255 g: 250 b: 205 #FFFACD | |
C_X11_YELLOW | r: 255 g: 255 b: 0 #FFFF00 | |
C_X11_LIGHT_YELLOW | r: 255 g: 255 b: 224 #FFFFE0 | |
C_X11_DARK_RED | r: 139 g: 0 b: 0 #8B0000 | |
C_X11_FIRE_BRICK | r: 178 g: 34 b: 34 #B22222 | |
C_X11_INDIAN_RED | r: 205 g: 92 b: 92 #CD5C5C | |
C_X11_CRIMSON | r: 220 g: 20 b: 60 #DC143C | |
C_X11_DARK_SALMON | r: 233 g: 150 b: 122 #E9967A | |
C_X11_LIGHT_CORAL | r: 240 g: 128 b: 128 #F08080 | |
C_X11_SALMON | r: 250 g: 128 b: 114 #FA8072 | |
C_X11_RED | r: 255 g: 0 b: 0 #FF0000 | |
C_X11_LIGHT_SALMON | r: 255 g: 160 b: 122 #FFA07A | |
C_X11_INDIGO | r: 75 g: 0 b: 130 #4B0082 | |
C_X11_PURPLE | r: 128 g: 0 b: 128 #800080 | |
C_X11_BLUE_VIOLET | r: 138 g: 43 b: 226 #8A2BE2 | |
C_X11_DARK_MAGENTA | r: 139 g: 0 b: 139 #8B008B | |
C_X11_MEDIUM_PURPLE | r: 147 g: 112 b: 219 #9370DB | |
C_X11_DARK_VIOLET | r: 148 g: 0 b: 211 #9400D3 | |
C_X11_DARK_ORCHID | r: 153 g: 50 b: 204 #9932CC | |
C_X11_MEDIUM_ORCHID | r: 186 g: 85 b: 211 #BA55D3 | |
C_X11_THISTLE | r: 216 g: 191 b: 216 #D8BFD8 | |
C_X11_ORCHID | r: 218 g: 112 b: 214 #DA70D6 | |
C_X11_PLUM | r: 221 g: 160 b: 221 #DDA0DD | |
C_X11_LAVENDER | r: 230 g: 230 b: 250 #E6E6FA | |
C_X11_VIOLET | r: 238 g: 130 b: 238 #EE82EE | |
C_X11_FUCHSIA | r: 255 g: 0 b: 255 #FF00FF | |
C_X11_MAGENTA | r: 255 g: 0 b: 255 #FF00FF | |
C_X11_DARK_GREEN | r: 0 g: 100 b: 0 #006400 | |
C_X11_GREEN | r: 0 g: 128 b: 0 #008000 | |
C_X11_MEDIUM_SPRING_GREEN | r: 0 g: 250 b: 154 #00FA9A | |
C_X11_LIME | r: 0 g: 255 b: 0 #00FF00 | |
C_X11_SPRING_GREEN | r: 0 g: 255 b: 127 #00FF7F | |
C_X11_FOREST_GREEN | r: 34 g: 139 b: 34 #228B22 | |
C_X11_SEA_GREEN | r: 46 g: 139 b: 87 #2E8B57 | |
C_X11_LIME_GREEN | r: 50 g: 205 b: 50 #32CD32 | |
C_X11_MEDIUM_SEA_GREEN | r: 60 g: 179 b: 113 #3CB371 | |
C_X11_DARK_OLIVE_GREEN | r: 85 g: 107 b: 47 #556B2F | |
C_X11_OLIVE_DRAB | r: 107 g: 142 b: 35 #6B8E23 | |
C_X11_LAWN_GREEN | r: 124 g: 252 b: 0 #7CFC00 | |
C_X11_CHARTREUSE | r: 127 g: 255 b: 0 #7FFF00 | |
C_X11_OLIVE | r: 128 g: 128 b: 0 #808000 | |
C_X11_DARK_SEA_GREEN | r: 143 g: 188 b: 143 #8FBC8F | |
C_X11_LIGHT_GREEN | r: 144 g: 238 b: 144 #90EE90 | |
C_X11_PALE_GREEN | r: 152 g: 251 b: 152 #98FB98 | |
C_X11_YELLOW_GREEN | r: 154 g: 205 b: 50 #9ACD32 | |
C_X11_GREEN_YELLOW | r: 173 g: 255 b: 47 #ADFF2F | |
C_X11_MAROON | r: 128 g: 0 b: 0 #800000 | |
C_X11_SADDLE_BROWN | r: 139 g: 69 b: 19 #8B4513 | |
C_X11_SIENNA | r: 160 g: 82 b: 45 #A0522D | |
C_X11_BROWN | r: 165 g: 42 b: 42 #A52A2A | |
C_X11_ROSY_BROWN | r: 188 g: 143 b: 143 #BC8F8F | |
C_X11_PERU | r: 205 g: 133 b: 63 #CD853F | |
C_X11_CHOCOLATE | r: 210 g: 105 b: 30 #D2691E | |
C_X11_TAN | r: 210 g: 180 b: 140 #D2B48C | |
C_X11_GOLDEN_ROD | r: 218 g: 165 b: 32 #DAA520 | |
C_X11_BURLY_WOOD | r: 222 g: 184 b: 135 #DEB887 | |
C_X11_SANDY_BROWN | r: 244 g: 164 b: 96 #F4A460 | |
C_X11_WHEAT | r: 245 g: 222 b: 179 #F5DEB3 | |
C_X11_NAVAJO_WHITE | r: 255 g: 222 b: 173 #FFDEAD | |
C_X11_BISQUE | r: 255 g: 228 b: 196 #FFE4C4 | |
C_X11_BLANCHED_ALMOND | r: 255 g: 235 b: 205 #FFEBCD | |
C_X11_CORN_SILK | r: 255 g: 248 b: 220 #FFF8DC | |
C_X11_NAVY | r: 0 g: 0 b: 128 #000080 | |
C_X11_DARK_BLUE | r: 0 g: 0 b: 139 #00008B | |
C_X11_MEDIUM_BLUE | r: 0 g: 0 b: 205 #0000CD | |
C_X11_BLUE | r: 0 g: 0 b: 255 #0000FF | |
C_X11_DEEP_SKY_BLUE | r: 0 g: 191 b: 255 #00BFFF | |
C_X11_MIDNIGHT_BLUE | r: 25 g: 25 b: 112 #191970 | |
C_X11_DODGER_BLUE | r: 30 g: 144 b: 255 #1E90FF | |
C_X11_ROYAL_BLUE | r: 65 g: 105 b: 225 #4169E1 | |
C_X11_STEEL_BLUE | r: 70 g: 130 b: 180 #4682B4 | |
C_X11_DARK_SLATE_BLUE | r: 72 g: 61 b: 139 #483D8B | |
C_X11_CORN_FLOWER_BLUE | r: 100 g: 149 b: 237 #6495ED | |
C_X11_SLATE_BLUE | r: 106 g: 90 b: 205 #6A5ACD | |
C_X11_MEDIUM_SLATE_BLUE | r: 123 g: 104 b: 238 #7B68EE | |
C_X11_SKY_BLUE | r: 135 g: 206 b: 235 #87CEEB | |
C_X11_LIGHT_SKY_BLUE | r: 135 g: 206 b: 250 #87CEFA | |
C_X11_LIGHT_BLUE | r: 173 g: 216 b: 230 #ADD8E6 | |
C_X11_LIGHT_STEEL_BLUE | r: 176 g: 196 b: 222 #B0C4DE | |
C_X11_POWDER_BLUE | r: 176 g: 224 b: 230 #B0E0E6 | |
C_X11_MEDIUM_VIOLET_RED | r: 199 g: 21 b: 133 #C71585 | |
C_X11_PALE_VIOLET_RED | r: 219 g: 112 b: 147 #DB7093 | |
C_X11_DEEP_PINK | r: 255 g: 20 b: 147 #FF1493 | |
C_X11_HOT_PINK | r: 255 g: 105 b: 180 #FF69B4 | |
C_X11_LIGHT_PINK | r: 255 g: 182 b: 193 #FFB6C1 | |
C_X11_PINK | r: 255 g: 192 b: 203 #FFC0CB | |
C_X11_BLACK | r: 0 g: 0 b: 0 #000000 | |
C_X11_DARK_SLATE_GRAY | r: 47 g: 79 b: 79 #2F4F4F | |
C_X11_DIM_GRAY | r: 105 g: 105 b: 105 #696969 | |
C_X11_SLATE_GRAY | r: 112 g: 128 b: 144 #708090 | |
C_X11_LIGHT_SLATE_GRAY | r: 119 g: 136 b: 153 #778899 | |
C_X11_GRAY | r: 128 g: 128 b: 128 #808080 | |
C_X11_DARK_GRAY | r: 169 g: 169 b: 169 #A9A9A9 | |
C_X11_SILVER | r: 192 g: 192 b: 192 #C0C0C0 | |
C_X11_LIGHT_GRAY | r: 211 g: 211 b: 211 #D3D3D3 | |
C_X11_GAINSBORO | r: 220 g: 220 b: 220 #DCDCDC |