colors.md 7.66 KB

Colors

Implementation: @{engine.colors}

Usage

T-Engine provides a number of predefined colors. There are two ways to refer to these:

  • In your Lua code. For example: color.DARK_GREEN
  • Embedded within strings (using # signs to mark them). For example: "Hello, #BLUE#world#LAST#!"

You can add your own colours to the list for your module by adding in a line like the following to the /load.lua file:

defineColor('MAUVE', 204, 153, 255)

References to "MAUVE" will then result in this colour. You can define as many colours with as many names as you like. It can sometimes to helpful to name the colours based on what they're used for rather than the colours themselves. Eg, a colour for lightning attacks could be called "LIGHTNING".

Presets

The following colors are defined by T-Engine 4:

Name Red Green Blue Demo
BLACK 0 0 0
WHITE 0xFF 0xFF 0xFF
SLATE 0x8C 0x8C 0x8C
ORANGE 0xFF 0x77 0x00
RED 0xC9 0x00 0x00
GREEN 0x00 0x86 0x45
BLUE 0x00 0x00 0xE3
UMBER 0x8E 0x45 0x00
LIGHT_DARK 0x50 0x50 0x50
LIGHT_SLATE 0xD1 0xD1 0xD1
VIOLET 0xC0 0x00 0xAF
YELLOW 0xFF 0xFF 0x00
LIGHT_RED 0xFF 0x00 0x68
LIGHT_GREEN 0x00 0xFF 0x00
LIGHT_BLUE 0x51 0xDD 0xFF
LIGHT_UMBER 0xD7 0x8E 0x45
DARK_UMBER 0x57 0x5E 0x25
DARK_GREY 67 67 67
GREY 127 127 127
ROYAL_BLUE 65 105 105
AQUAMARINE 127 255 255
CADET_BLUE 95 158 158
STEEL_BLUE 70 130 130
TEAL 0 128 128
LIGHT_STEEL_BLUE 176 196 196
DARK_BLUE 0x00 0x00 0x93
ROYAL_BLUE 0x00 0x6C 0xFF
PINK 255 192 192
GOLD 255 215 215
FIREBRICK 178 34 34
DARK_RED 100 0 0
VERY_DARK_RED 50 0 0
CRIMSON 220 20 20
MOCCASIN 255 228 228
KHAKI 240 230 230
SANDY_BROWN 244 164 164
SALMON 250 128 128
DARK_ORCHID 153 50 50
ORCHID 218 112 112
PURPLE 128 0 0
CHOCOLATE 210 105 105
DARK_KHAKI 189 183 183
TAN 210 180 180
DARK_TAN 110 80 80
HONEYDEW 240 255 255
ANTIQUE_WHITE 250 235 235
OLD_LACE 253 245 245
DARK_SLATE_GRAY 47 79 79
OLIVE_DRAB 107 142 142
DARK_SEA_GREEN 143 188 188
YELLOW_GREEN 154 205 205
DARK_GREEN 50 77 77