Template:Shade/bgcolor: Difference between revisions

From Campaigns
Jump to navigation Jump to search
m 1 revision imported
mNo edit summary
 
Line 1: Line 1:
{{#invoke:BaseConvert|10to16|{{#expr:({{{r|0}}}*{{{a|0}}}+{{{r_bg|255}}}*(1-{{{a|0}}})) round 0}}|precision=0}}{{#invoke:BaseConvert|10to16|{{#expr:({{{g|0}}}*{{{a|0}}}+{{{g_bg|255}}}*(1-{{{a|0}}})) round 0}}|precision=0}}{{#invoke:BaseConvert|10to16|{{#expr:({{{b|0}}}*{{{a|0}}}+{{{b_bg|255}}}*(1-{{{a|0}}})) round 0}}|precision=0}}<noinclude>{{documentation|content=
{{#invoke:BaseConvert|10to16|{{#expr:({{{r|0}}}*{{{a|0}}}+{{{r_bg|255}}}*(1-{{{a|0}}})) round 0}}|precision=0}}{{#invoke:BaseConvert|10to16|{{#expr:({{{g|0}}}*{{{a|0}}}+{{{g_bg|255}}}*(1-{{{a|0}}})) round 0}}|precision=0}}{{#invoke:BaseConvert|10to16|{{#expr:({{{b|0}}}*{{{a|0}}}+{{{b_bg|255}}}*(1-{{{a|0}}})) round 0}}|precision=0}}<noinclude>{{documentation|content=
Calculates an RGB hex triplet naively blended over a (by default) white background, i.e.
Calculates an RGB hex triplet naively blended over a (by default) white background, i.e.
{{block indent|1=
 
<math>C_o = C_a \alpha + C_{bg} (1 - \alpha)</math>
<math>C_o = C_a \alpha + C_{bg} (1 - \alpha)</math>
}}


The visual properties of a naive (nonlinear) sRGB blend is that color blending with greyscales mostly "work" visually.<ref>{{cite web |title=Color gradient algorithm |url=https://stackoverflow.com/questions/22607043/color-gradient-algorithm|access-date=2021-07-21 |website=Stack Overflow}}</ref>
The visual properties of a naive (nonlinear) sRGB blend is that color blending with greyscales mostly "work" visually.
<pre style="overflow:auto">
<pre style="overflow:auto">
{{Shade/bgcolor
{{Shade/bgcolor

Latest revision as of 12:15, 24 November 2021

FFFFFF

Template documentation

Calculates an RGB hex triplet naively blended over a (by default) white background, i.e.

Co=Caα+Cbg(1α)

The visual properties of a naive (nonlinear) sRGB blend is that color blending with greyscales mostly "work" visually.

{{Shade/bgcolor
|r    = <!-- red color component: 0-255 (default=0) -->
|g    = <!-- green color component: 0-255 (default=0) -->
|b    = <!-- blue color component: 0-255 (default=0) -->
|a    = <!-- color transparency factor: 0.0-1.0 (default=0) -->
|r_bg = <!-- red background color component: 0-255 (default=255) -->
|g_bg = <!-- green background color component: 0-255 (default=255) -->
|b_bg = <!-- blue background color component: 0-255 (default=255) -->
}}