diff --git a/patchwork.md b/patchwork.md index bf4280921..b0e8deb6b 100644 --- a/patchwork.md +++ b/patchwork.md @@ -132,3 +132,8 @@ Fix my docs Thanks @plt-hokusai. Kinda embarrassing this slipped through - I evidently need to lint examples too. ``` + +``` +34a2c835d412c0d9e1fb20a42b7f2cd2738289c7 +Add color table to docs (#553) +``` diff --git a/src/main/resources/data/computercraft/lua/rom/apis/colors.lua b/src/main/resources/data/computercraft/lua/rom/apis/colors.lua index a941fa287..211e9975c 100644 --- a/src/main/resources/data/computercraft/lua/rom/apis/colors.lua +++ b/src/main/resources/data/computercraft/lua/rom/apis/colors.lua @@ -1,15 +1,137 @@ ---- The Colors API allows you to manipulate sets of colors. --- --- This is useful in conjunction with Bundled Cables from the RedPower mod, --- RedNet Cables from the MineFactory Reloaded mod, and colors on Advanced --- Computers and Advanced Monitors. --- --- For the non-American English version just replace @{colors} with @{colours} --- and it will use the other API, colours which is exactly the same, except in --- British English (e.g. @{colors.gray} is spelt @{colours.grey}). --- --- @see colours --- @module colors +--[[- The Colors API allows you to manipulate sets of colors. + +This is useful in conjunction with Bundled Cables from the RedPower mod, RedNet +Cables from the MineFactory Reloaded mod, and colors on Advanced Computers and +Advanced Monitors. + +For the non-American English version just replace @{colors} with @{colours} and +it will use the other API, colours which is exactly the same, except in British +English (e.g. @{colors.gray} is spelt @{colours.grey}). + +On basic terminals (such as the Computer and Monitor), all the colors are +converted to grayscale. This means you can still use all 16 colors on the +screen, but they will appear as the nearest tint of gray. You can check if a +terminal supports color by using the function @{term.isColor}. + +Grayscale colors are calculated by taking the average of the three components, +i.e. `(red + green + blue) / 3`. + +
Default Colors | |||||||
---|---|---|---|---|---|---|---|
Color | +Value | +Default Palette Color | +|||||
Dec | Hex | Paint/Blit | +Preview | Hex | RGB | Grayscale | +|
colors.white |
+ 1 | 0x1 | 0 | +#F0F0F0 | 240, 240, 240 | ++ | |
colors.orange |
+ 2 | 0x2 | 1 | +#F2B233 | 242, 178, 51 | ++ | |
colors.magenta |
+ 4 | 0x4 | 2 | +#E57FD8 | 229, 127, 216 | ++ | |
colors.lightBlue |
+ 8 | 0x8 | 3 | +#99B2F2 | 153, 178, 242 | ++ | |
colors.yellow |
+ 16 | 0x10 | 4 | +#DEDE6C | 222, 222, 108 | ++ | |
colors.lime |
+ 32 | 0x20 | 5 | +#7FCC19 | 127, 204, 25 | ++ | |
colors.pink |
+ 64 | 0x40 | 6 | +#F2B2CC | 242, 178, 204 | ++ | |
colors.gray |
+ 128 | 0x80 | 7 | +#4C4C4C | 76, 76, 76 | ++ | |
colors.lightGray |
+ 256 | 0x100 | 8 | +#999999 | 153, 153, 153 | ++ | |
colors.cyan |
+ 512 | 0x200 | 9 | +#4C99B2 | 76, 153, 178 | ++ | |
colors.purple |
+ 1024 | 0x400 | a | +#B266E5 | 178, 102, 229 | ++ | |
colors.blue |
+ 2048 | 0x800 | b | +#3366CC | 51, 102, 204 | ++ | |
colors.brown |
+ 4096 | 0x1000 | c | +#7F664C | 127, 102, 76 | ++ | |
colors.green |
+ 8192 | 0x2000 | d | +#57A64E | 87, 166, 78 | ++ | |
colors.red |
+ 16384 | 0x4000 | e | +#CC4C4C | 204, 76, 76 | ++ | |
colors.black |
+ 32768 | 0x8000 | f | +#111111 | 17, 17, 17 | ++ |