Difference between revisions of "Template:Color/doc"
(from sandbox) |
m |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | == Overview == | |
− | + | Color produces a small colored square using a provided set of RGB or optional RGBA values. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <!-- web browsers like to override background-color when using dark mode, so you'll instead get these inaccurate contrast shifted colors unless you are using light mode. The worst cases are black and white being swapped completely, so only mid range colors will show up properly --> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
255, 255, 255: #FFFFFF; White | 255, 255, 255: #FFFFFF; White | ||
{{Color|text=false|rgb=255,255,255}} | {{Color|text=false|rgb=255,255,255}} | ||
− | |||
255, 0, 0: #FF0000; Red | 255, 0, 0: #FF0000; Red | ||
{{Color|text=false|rgb=255,0,0}} | {{Color|text=false|rgb=255,0,0}} | ||
− | |||
0, 255, 0: #00FF00; Green | 0, 255, 0: #00FF00; Green | ||
{{Color|text=false|rgb=0,255,0}} | {{Color|text=false|rgb=0,255,0}} | ||
− | |||
0, 0, 255: #0000FF; Blue | 0, 0, 255: #0000FF; Blue | ||
{{Color|text=false|rgb=0,0,255}} | {{Color|text=false|rgb=0,0,255}} | ||
− | |||
255, 255, 0: #FFFF00; Yellow | 255, 255, 0: #FFFF00; Yellow | ||
{{Color|text=false|rgb=255,255,0}} | {{Color|text=false|rgb=255,255,0}} | ||
− | |||
0, 255, 255: #00FFFF; Cyan | 0, 255, 255: #00FFFF; Cyan | ||
{{Color|text=false|rgb=0,255,255}} | {{Color|text=false|rgb=0,255,255}} | ||
− | |||
255, 0, 255: #FF00FF; Magenta | 255, 0, 255: #FF00FF; Magenta | ||
{{Color|text=false|rgb=255,0,255}} | {{Color|text=false|rgb=255,0,255}} | ||
− | |||
0, 0, 0: #000000; Black | 0, 0, 0: #000000; Black | ||
{{Color|text=false|rgb=0,0,0}} | {{Color|text=false|rgb=0,0,0}} | ||
− | + | === Alpha === | |
+ | The alpha channel can be appended as a 4th value to control opacity. This can be represented as a percentage (0% - 100%), or value ranging from 0 - 1. If no alpha is provided, it defaults to 100%. | ||
− | + | 160,178,181, | |
+ | <nowiki>{{Color|rgba=160,178,181,}}</nowiki> | ||
+ | {{Color|rgba=160,178,181,}} | ||
− | + | 160,178,181,0% | |
+ | <nowiki>{{Color|rgba=160,178,181,0%}}</nowiki> | ||
+ | {{Color|rgba=160,178,181,0%}} | ||
− | = | + | 160, 178, 181, 25% |
− | 160,178,181, | + | <nowiki>{{Color|rgba=160, 178, 181, 25%}}</nowiki> |
− | {{Color|rgba=160,178,181, | + | {{Color|rgba=160, 178, 181, 25%}} |
− | 160, 178, 181, | + | (160,178,181,50%) |
− | {{Color|rgba=160, 178, 181, | + | <nowiki>{{Color|rgba=(160,178,181,50%)}}</nowiki> |
+ | {{Color|rgba=(160,178,181,50%)}} | ||
− | (160,178,181, | + | (160, 178, 181, 75%) |
− | {{Color|rgba=(160,178,181, | + | <nowiki>{{Color|rgba=(160, 178, 181, 75%)}}</nowiki> |
+ | {{Color|rgba=(160, 178, 181, 75%)}} | ||
− | (160, 178, 181, 100) | + | ( 160, 178, 181, 100% ) |
− | {{Color|rgba=(160, 178, 181, 100)}} | + | <nowiki>{{Color|rgba=( 160, 178, 181, 100% )}}</nowiki> |
+ | {{Color|rgba=( 160, 178, 181, 100% )}} | ||
− | ( 160, 178, 181 ) | + | ( 160, 178, 181, 0.5 ) |
− | {{Color|rgba=( 160, 178, 181, | + | <nowiki>{{Color|rgba=( 160, 178, 181, 0.5 )}}</nowiki> |
+ | {{Color|rgba=( 160, 178, 181, 0.5 )}} | ||
− | = | + | ( 160, 178, 181, 0.75 ) |
− | 160 | + | <nowiki>{{Color|rgba=( 160, 178, 181, 0.75 )}}</nowiki> |
− | {{Color|160 | + | {{Color|rgba=( 160, 178, 181, 0.75 )}} |
− | + | === Optional parameters === | |
− | + | Optional parameters include toggling the text color code, border, and resizing the square. | |
− | |||
text=false | text=false | ||
+ | <nowiki>{{Color|rgb=160,178,181|text=false}}</nowiki> | ||
{{Color|rgb=160,178,181|text=false}} | {{Color|rgb=160,178,181|text=false}} | ||
border=false | border=false | ||
+ | <nowiki>{{Color|rgb=160,178,181|border=false}}</nowiki> | ||
{{Color|rgb=160,178,181|border=false}} | {{Color|rgb=160,178,181|border=false}} | ||
size=50px | size=50px | ||
+ | <nowiki>{{Color|rgb=160,178,181|size=50px}}</nowiki> | ||
{{Color|rgb=160,178,181|size=50px}} | {{Color|rgb=160,178,181|size=50px}} | ||
− | == Invalid | + | |
+ | |||
+ | == Alternate usage == | ||
+ | The format in which these values can be inputted is quite flexible: | ||
+ | * Individual parameters: | ||
+ | <nowiki>{{Color|r|g|b}}</nowiki> | ||
+ | * Comma separated list of values assigned to value rgb: | ||
+ | <nowiki>{{Color|rgb=r,g,b}}</nowiki> | ||
+ | * Comma and space separated list: | ||
+ | <nowiki>{{Color|rgb=r, g, b}}</nowiki> | ||
+ | * Comma and space separated list inside of parentheses: | ||
+ | <nowiki>{{Color|rgb=(r, g, b)}}</nowiki> | ||
+ | |||
+ | 160|178|181 | ||
+ | {{Color|160|178|181}} | ||
+ | |||
+ | 160|178|181|100 | ||
+ | {{Color|160|178|181|100}} | ||
+ | |||
+ | == Examples == | ||
+ | |||
+ | Here is some text. It is in English. | ||
+ | |||
+ | Things made of plasteel will use the color {{Color|rgb=160,178,181}}. This color is blue. | ||
+ | |||
+ | Lorem ipsum dolor sit amet. | ||
+ | |||
+ | 160,178,181 | ||
+ | {{Color|rgb=160,178,181}} | ||
+ | |||
+ | 160, 178, 181 | ||
+ | {{Color|rgb=160, 178, 181}} | ||
+ | |||
+ | (160,178,181) | ||
+ | {{Color|rgb=(160,178,181)}} | ||
+ | |||
+ | (160, 178, 181) | ||
+ | {{Color|rgb=(160, 178, 181)}} | ||
+ | |||
+ | ( 160, 178, 181 ) | ||
+ | {{Color|rgb=( 160, 178, 181 )}} | ||
+ | |||
+ | <div class="infobox float:right;"> | ||
+ | <p class="heading">Rock</p> | ||
+ | <div class="wrapper"> | ||
+ | <div class="image_wrapper" title="Rock">[[File:Bioferrite b.png|250x250px]]</div> | ||
+ | <p class="text-center" style="display:block; font-size:89%; padding: .5em;">A cool rock I found.</p> | ||
+ | <p class='subheading' style='height: 1em !important; padding: 0.25em 0 0.5em !important'>Base Stats</p> | ||
+ | <dl> | ||
+ | ;Stuff Category | ||
+ | :Rock | ||
+ | ;Stuff Color | ||
+ | :{{Color|rgb=(100,80,80)}} | ||
+ | ;Tech Level | ||
+ | :Rock | ||
+ | ;Weapon Class | ||
+ | :Rock | ||
+ | </dl>{{clear}} | ||
+ | </div> | ||
+ | </div> | ||
+ | |||
+ | == Invalid Inputs == | ||
Not within 0-255 rgb range: | Not within 0-255 rgb range: | ||
<nowiki>{{Color|text=false|256,256,256}}</nowiki> | <nowiki>{{Color|text=false|256,256,256}}</nowiki> | ||
Line 111: | Line 147: | ||
{{Color|rgb=#ffeeaa}} | {{Color|rgb=#ffeeaa}} | ||
− | <noinclude>[[Category: Template documentation]]</noinclude> | + | <noinclude>[[Category:Template documentation]]</noinclude> |
+ | <includeonly>[[Category:Templates]]</includeonly> |
Latest revision as of 19:58, 8 August 2024
Overview[edit]
Color produces a small colored square using a provided set of RGB or optional RGBA values.
255, 255, 255: #FFFFFF; White
255, 0, 0: #FF0000; Red
(255, 0, 0)0, 255, 0: #00FF00; Green
(0, 255, 0)0, 0, 255: #0000FF; Blue
(0, 0, 255)255, 255, 0: #FFFF00; Yellow
(255, 255, 0)0, 255, 255: #00FFFF; Cyan
(0, 255, 255)255, 0, 255: #FF00FF; Magenta
(255, 0, 255)0, 0, 0: #000000; Black
(0, 0, 0)Alpha[edit]
The alpha channel can be appended as a 4th value to control opacity. This can be represented as a percentage (0% - 100%), or value ranging from 0 - 1. If no alpha is provided, it defaults to 100%.
160,178,181,
{{Color|rgba=160,178,181,}}
160,178,181,0%
{{Color|rgba=160,178,181,0%}}
160, 178, 181, 25%
{{Color|rgba=160, 178, 181, 25%}}
(160,178,181,50%)
{{Color|rgba=(160,178,181,50%)}}
(160, 178, 181, 75%)
{{Color|rgba=(160, 178, 181, 75%)}}
( 160, 178, 181, 100% )
{{Color|rgba=( 160, 178, 181, 100% )}}
( 160, 178, 181, 0.5 )
{{Color|rgba=( 160, 178, 181, 0.5 )}}
( 160, 178, 181, 0.75 )
{{Color|rgba=( 160, 178, 181, 0.75 )}}
Optional parameters[edit]
Optional parameters include toggling the text color code, border, and resizing the square.
text=false
{{Color|rgb=160,178,181|text=false}}(160, 178, 181)
border=false
{{Color|rgb=160,178,181|border=false}}
size=50px
{{Color|rgb=160,178,181|size=50px}}
Alternate usage[edit]
The format in which these values can be inputted is quite flexible:
- Individual parameters:
{{Color|r|g|b}}
- Comma separated list of values assigned to value rgb:
{{Color|rgb=r,g,b}}
- Comma and space separated list:
{{Color|rgb=r, g, b}}
- Comma and space separated list inside of parentheses:
{{Color|rgb=(r, g, b)}}
160|178|181
160|178|181|100
Examples[edit]
Here is some text. It is in English.
Things made of plasteel will use the color
. This color is blue.
Lorem ipsum dolor sit amet.
160,178,181
160, 178, 181
(160,178,181)
(160, 178, 181)
( 160, 178, 181 )
Rock
Invalid Inputs[edit]
Not within 0-255 rgb range:
{{Color|text=false|256,256,256}}(256,256,256, 255, 255)
{{Color|rgb=700,700,700}}
Color name: red
{{Color|red}}
Hexidecimal color code: #ffeeaa
{{Color|rgb=#ffeeaa}}