diff --git a/doc/styles.css b/doc/styles.css index 2bcc830cc..da9fbec6a 100644 --- a/doc/styles.css +++ b/doc/styles.css @@ -111,7 +111,7 @@ footer { } /* The definition lists at the top of each page */ -table.definition-list { +table.definition-list, table.pretty-table { border-collapse: collapse; width: 100%; } @@ -130,6 +130,16 @@ table.definition-list th { table.definition-list td { width: 100%; } +/* Pretty tables, mostly inherited from table.definition-list */ +table.pretty-table td, table.pretty-table th { + border: 1px solid #cccccc; + padding: 2px 4px; +} + +table.pretty-table th { + background-color: #f0f0f0; +} + dl.definition dt { border-top: 1px solid #ccc; padding-top: 1em; 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..1edb47bce 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
ColorValueDefault Palette Color
DecHexPaint/BlitPreviewHexRGBGrayscale
colors.white10x10#F0F0F0240, 240, 240
colors.orange20x21#F2B233242, 178, 51
colors.magenta40x42#E57FD8229, 127, 216
colors.lightBlue80x83#99B2F2153, 178, 242
colors.yellow160x104#DEDE6C222, 222, 108
colors.lime320x205#7FCC19127, 204, 25
colors.pink640x406#F2B2CC242, 178, 204
colors.gray1280x807#4C4C4C76, 76, 76
colors.lightGray2560x1008#999999153, 153, 153
colors.cyan5120x2009#4C99B276, 153, 178
colors.purple10240x400a#B266E5178, 102, 229
colors.blue20480x800b#3366CC51, 102, 204
colors.brown40960x1000c#7F664C127, 102, 76
colors.green81920x2000d#57A64E87, 166, 78
colors.red163840x4000e#CC4C4C204, 76, 76
colors.black327680x8000f#11111117, 17, 17
+ +@see colours +@module colors +]] local expect = dofile("rom/modules/main/cc/expect.lua").expect @@ -37,7 +159,7 @@ yellow = 0x10 -- terminal colour of #7FCC19. lime = 0x20 ---- Pink. Written as `6` in paint files and @{term.blit}, has a default +--- Pink: Written as `6` in paint files and @{term.blit}, has a default -- terminal colour of #F2B2CC. pink = 0x40 @@ -74,10 +196,11 @@ green = 0x2000 red = 0x4000 --- Black: Written as `f` in paint files and @{term.blit}, has a default --- terminal colour of #191919. +-- terminal colour of #111111. black = 0x8000 ---- Combines a set of colors (or sets of colors) into a larger set. +--- Combines a set of colors (or sets of colors) into a larger set. Useful for +-- Bundled Cables. -- -- @tparam number ... The colors to combine. -- @treturn number The union of the color sets given in `...` @@ -96,7 +219,8 @@ function combine(...) return r end ---- Removes one or more colors (or sets of colors) from an initial set. +--- Removes one or more colors (or sets of colors) from an initial set. Useful +-- for Bundled Cables. -- -- Each parameter beyond the first may be a single color or may be a set of -- colors (in the latter case, all colors in the set are removed from the @@ -121,7 +245,8 @@ function subtract(colors, ...) return r end ---- Tests whether `color` is contained within `colors`. +--- Tests whether `color` is contained within `colors`. Useful for Bundled +-- Cables. -- -- @tparam number colors A color, or color set -- @tparam number color A color or set of colors that `colors` should contain.