Template:Color

From EarthMC
Jump to navigation Jump to search

{{{2}}}

Usage

This template is used to set the color for text.

Explain

{{Color|<color>|<text>}}

Set the color<color>for<text>. The format of<color>is as follows[1]https://developer.mozilla.org/zh-CN/docs/Web/CSS/colorhttps://developer.mozilla.org/zh-CN/docs/Web/CSS/color_value

  • A "color keyword" word.
    The existing keywords are as follows:

    • black
    • silver
    • gray
    • white
    • maroon
    • red
    • purple
    • fuchsia
    • green
    • lime
    • olive
    • yellow
    • navy
    • blue
    • teal
    • aqua
    • orange
    • aliceblue
    • antiquewhite
    • aquamarine
    • azure
    • beige
    • bisque
    • blanchedalmond
    • blueviolet
    • brown
    • burlywood
    • cadetblue
    • chartreuse
    • chocolate
    • coral
    • cornflowerblue
    • cornsilk
    • crimson
    • darkblue
    • darkcyan
    • darkgoldenrod
    • darkgray
    • darkgreen
    • darkgrey
    • darkkhaki
    • darkmagenta
    • darkolivegreen
    • darkorange
    • darkorchid
    • darkred
    • darksalmon
    • darkseagreen
    • darkslateblue
    • darkslategray
    • darkslategrey
    • darkturquoise
    • darkviolet
    • deeppink
    • deepskyblue
    • dimgray
    • dimgrey
    • dodgerblue
    • firebrick
    • floralwhite
    • forestgreen
    • gainsboro
    • ghostwhite
    • gold
    • goldenrod
    • greenyellow
    • grey
    • honeydew
    • hotpink
    • indianred
    • indigo
    • ivory
    • khaki
    • lavender
    • lavenderblush
    • lawngreen
    • lemonchiffon
    • lightblue
    • lightcoral
    • lightcyan
    • lightgoldenrodyellow
    • lightgray
    • lightgreen
    • lightgrey
    • lightpink
    • lightsalmon
    • lightseagreen
    • lightskyblue
    • lightslategray
    • lightslategrey
    • lightsteelblue
    • lightyellow
    • limegreen
    • linen
    • mediumaquamarine
    • mediumblue
    • mediumorchid
    • mediumpurple
    • mediumseagreen
    • mediumslateblue
    • mediumspringgreen
    • mediumturquoise
    • mediumvioletred
    • midnightblue
    • mintcream
    • mistyrose
    • moccasin
    • navajowhite
    • oldlace
    • olivedrab
    • orangered
    • orchid
    • palegoldenrod
    • palegreen
    • paleturquoise
    • palevioletred
    • papayawhip
    • peachpuff
    • peru
    • pink
    • plum
    • powderblue
    • rosybrown
    • royalblue
    • saddlebrown
    • salmon
    • sandybrown
    • seagreen
    • seashell
    • sienna
    • skyblue
    • slateblue
    • slategray
    • slategrey
    • snow
    • springgreen
    • steelblue
    • tan
    • thistle
    • tomato
    • turquoise
    • violet
    • wheat
    • whitesmoke
    • yellowgreen
    • rebeccapurple
  • transparent Keyword. In the old CSS color standard, transparency is not supported as a virtual color, but in the third version, it has become the abbreviation of transparent colorrgba (0, 0, 0).
  • currentColor Keyword, which is mainly used for other color attributes (such as background color and border color) to use the current or parent element'scolorcolor, but can also be used here to inherit the parent element's color.
  • RGB mode: the mode is composed of red, green and blue colors in proportion, and has two writing methods (useR,G,Bto represent the proportions of red, green and blue colors respectively):
    • # RRGGBB/# RGB, all colors here can only be filled with two or one digit hexadecimal integer values, and the ratio is calculated according to the ratio between the actual value and 255 (FF).
      • All colors either use two hexadecimal integer values (the actual value is the value at this time), or use one hexadecimal integer value (at this time, the actual value is calculated according to the same two digit value, for example,# CBAis calculated according to# CCBBAA).
    • rgb (RR, GG, BB), where all colors are either two digit hexadecimal integer values, calculate the proportion according to the ratio between the actual value and 255 (FF), or directly fill in the percentage proportion (0% to 100%, only integer values can be used, the same below) (for example,rgb (100%, 0%, 20%)).
  • Hsl mode: this mode uses hue, saturation and lightness to calculate color, among which:
    • The hue uses a unitless angle, and the value is an integer. The remainder after dividing by 360 is used to calculate the actual value, which refers to the color scattered on the circumference of a circle (for example, 0 refers to red, 120 refers to green, and 240 refers to blue)
    • Saturation uses percentage ratio. The higher the color is, the purer it is, and the lower it is, the grayer it becomes.
    • The lightness uses the percentage ratio. The higher the color is, the more white it is. At 100%, it is pure white regardless of hue and saturation. The lower the color is, the more black it is. At 0%, it is pure black.
    The writing method is as follows:hsl (0, 100%, 50%), etc.
  • RGBA and hsla modes: This mode is an extension of the above two modes. The key is to add a new alpha channel to support transparency. The expanded writing method is as follows:
    RGBA
    *# RRGGBBAA/# RGBA, the digits of alpha channel here are consistent with those of other colors, and the actual values of alpha channel in the latter are calculated by the same two digit numerical values as other colors (for example,# CBA9calculated by# CCBBAA99).
    *rgba (RR, GG, BB, AA), where the number of digits in the alpha channel is the same as that in other colors, either they are two hexadecimal integer values or they are both percentages.
    hsla
    Write in the form ofhsla (0, 100%, 50%, 37%)
    The lower the alpha value is, the more transparent the color is. The higher the alpha value is, the more opaque the color is. The higher the alpha value is, the more opaque the color is. The F/FF/100% is, the more opaque the color is. (The rgb and hsl modes can be understood as the alpha value is 100%.)

Note: This template can only be used for intra row content, and cannot be used across rows!