This template is within the scope of WikiProject Accessibility, a group of editors promoting better access for disabled or otherwise disadvantaged users. For more information, such as what you can do to help, see the main project page.AccessibilityWikipedia:WikiProject AccessibilityTemplate:WikiProject AccessibilityAccessibility
Text has been copied to or from this page; see the list below. The source pages now serve to provide attribution for the content in the destination pages and must not be deleted as long as the copies exist. For attribution and to access older versions of the copied text, please see the history links below.
Please remove the usage section and replace it with the {{Documentation}} template as I've created a documentation subpage at Template:Fontcolor/doc. A specific description of the request follows below. Thanks.
Change this:
{{#if:{{{3|}}}|<span style="background-color:{{{2|inherit}}};color:{{{1|inherit}}};">{{{3|}}}</span>|<span style="color:{{{1|inherit}}};">{{{2|}}}</span>}}<noinclude>
== Usage ==
'''<nowiki>{{fontcolor|text_color|background_color|text}}</nowiki>'''
Examples of use:
*'''<nowiki>{{fontcolor|green|this is about plants}}</nowiki>''': {{fontcolor|green|this is about plants}}:(it appears in green text).
*'''<nowiki>{{fontcolor||red|text in red background}}</nowiki>''': {{fontcolor||red|text in red background}}:(no parameters are used for the text color, only for the background)
*'''<nowiki>{{fontcolor|red|yellow|red text with yellow background}}</nowiki>''': {{fontcolor|red|yellow|red text with yellow background}}
== See also ==
* [[HTML color names]]
* [[List of colors]]
[[Category:text color templates]]
[[pt:Predefinição:Fontcolor]]
[[sl:Predloga:Barvapis]]
[[zh:Template:Fontcolor]]
</noinclude>
To this:
{{#if:{{{3|}}}|<span style="background-color:{{{2|inherit}}};color:{{{1|inherit}}};">{{{3|}}}</span>|<span style="color:{{{1|inherit}}};">{{{2|}}}</span>}}<noinclude>
<!-- Add categories and interwikis to the /doc subpage, not here! -->
{{Documentation}}</noinclude>
I added |link= to {{font color/sandbox}} to add a wikilink. The use is when the blue link would be non-accessible on a background such as a navbox header. A search shows this use is prevelant.
|link=yes sets the link to the test
|link=link sets the link to the link text
Markup
Renders as
[[Universities Research Association|{{font color|white|blue|Universities Research Association}}]]
One, two lines of the template were setting the background colour to {{{2}}} in the two-parameter case, where the second parameter is the text to be displayed, not a colour name.
Two, when templates are expanded as part of a signature, the software does not remove the comments. So the comment in the first #if was breaking the logic of the template; the #if was always coming out true. This behaviour could also be seen in the result from Special:ExpandTemplates. -- John of Reading (talk) 08:12, 16 December 2014 (UTC)[reply]
Added more named parameters
Per sandbox and new testcases, named parameters now work for {{{1}}}{{{2}}} and {{{3}}}.
If this is OK, yet not documented withing a while, I'll document it.
fg=1 bg=2 text=3. Link=4 was already there. — CpiralCpiral08:30, 25 November 2015 (UTC)[reply]
I'm not quite sure what you're proposing (you could mock it up the sandbox if you want to demonstrate), but generally I think it's not a good idea to expand the functionality of this template beyond just selecting the color. If we were to do that we'd just want to merge it with {{Font}}. {{u|Sdkb}}talk08:17, 11 December 2020 (UTC)[reply]
Color of link underline
Currently, if a link is colored using this template, the underline is not colored appropriately, e.g. Main Page. {{Colored link}} properly handles this via the CSS text-decoration: inherit; I'd personally suggest to just shell out to {{Colored link}} when this template is used to color a link, but the CSS could also be added here directly. 「ディノ奴千?!」☎ Dinoguy100011:53, 12 November 2021 (UTC)[reply]
Displaying different colors for light/dark modes
Is there a way to display one color in light mode and a different color in dark mode? For example, if I want to show blue text for users using light mode, but I want to show light blue text for users using dark mode, is there a way to do this? The Sands of Time 0 (talk) 00:26, 19 May 2025 (UTC)[reply]