Template:Sitenotice: Difference between revisions
Jump to navigation
Jump to search
Tag: Undo |
mNo edit summary |
||
| Line 3: | Line 3: | ||
| <!-- With image --> | | <!-- With image --> | ||
<div class="{{{image bg|}}} {{{text color|}}}" style="display: flex; align-items: center; background: {{{image bg|}}}; padding: .4em 1em; border-radius: .4em 0 0 .4em">{{{image|}}}</div> | <div class="{{{image bg|}}} {{{text color|}}}" style="display: flex; align-items: center; background: {{{image bg|}}}; padding: .4em 1em; border-radius: .4em 0 0 .4em">{{{image|}}}</div> | ||
<div class="{{{text bg|}}} {{{text color|}}}" style="display: flex; background: {{{text bg|}}}; color: {{{text color|}}}; padding: 1em 2.5em 1em 1.25em; border-radius: 0 .4em .4em 0"><p style="margin: auto !important; text-align: center;">{{{text|}}} | <div class="{{{text bg|}}} {{{text color|}}}" style="display: flex; background: {{{text bg|}}}; color: {{{text color|}}}; padding: 1em 2.5em 1em 1.25em; border-radius: 0 .4em .4em 0"><p style="margin: auto !important; text-align: center;">{{{text|}}}</div> | ||
| <!-- Text only --> | | <!-- Text only --> | ||
<div class="{{{text bg|}}} {{{text color|}}}" style="display: flex; background: {{{text bg|}}}; color: {{{text color|}}}; padding: 1em 2.5em 1em 1.25em; border-radius: .4em"><p style="margin: auto !important; text-align: center;">{{{text|}}}</p> | <div class="{{{text bg|}}} {{{text color|}}}" style="display: flex; background: {{{text bg|}}}; color: {{{text color|}}}; padding: 1em 2.5em 1em 1.25em; border-radius: .4em"><p style="margin: auto !important; text-align: center;">{{{text|}}}</p></div>}} | ||
</div> | </div> | ||
<noinclude>{{/doc}}</noinclude> | <noinclude>{{/doc}}</noinclude> | ||
Latest revision as of 16:16, 12 June 2020
Template documentation
This documentation is transcluded from Template:Sitenotice/doc. [edit] [purge]
This template is used on MediaWiki:Sitenotice
Usage
{{Sitenotice
|type = Type of site notice (all site notices of type are dismissed together regardless of notice number)
|image = Displays an image before the text (should be set to x40px if it's too big).
|image bg = Color of the div where the image is displayed (Hex, Name or Class).
|text = Text to be displayed
|text bg = Color of the div where the text is displayed (Hex, Name or Class).
|text color = If for some reason you need the text to be a different color (Hex, Name or Class).
}}
- The
|typeparameter may be omitted. All site notices of a given type are dismissed together regardless of the site notice id number. For example if a site notice of type oswf is dismissed, no other oswf type site messages will be displayed to the user (regardless of notice number). - The
|imageparameter may be omitted, leaving the text full width.|image bgwill be automatically omitted with it. - Existing color classes may be used on
|text bgand|image bginstead, listed below. These will automatically switch between dark and ligth modes.- These classes are defined in MediaWiki:Common.less/wikitables.less, and overridden for dark mode in MediaWiki:Vector-darkmode.less/wikitables.less.
| Backgrounds | Text |
|---|---|
| table-bg-red | text-red |
| table-bg-orange | text-orange |
| table-bg-yellow | text-yellow |
| table-bg-green | text-green |
| table-bg-blue | text-blue |
| table-bg-purple | text-purple |
| table-bg-pink | text-pink |
| table-bg-grey | text-grey |
Note that %CLOSE% is replaced by the close X, positioned absolutely in the top right of the parent (or left for ltr), however any padding/margins etc to ensure that the X does not overlap the contents must be added manually (done within this template).
Examples
| Code | Result |
|---|---|
{{Sitenotice
|image = [[File:Earth Icon.png|x40px]]
|image bg = #801c13
|text = This is where you will write your text. You can use <code><choose></code> and such.
|text bg = #9f261e
|text color = white
}}
|
This is where you will write your text. You can use <choose> and such. |
{{Sitenotice
|text = This is a text only sitenotice where the image was omitted, with changing background and text colors.
|text bg = table-bg-green
|text color = text-green
}}
|
This is a text only sitenotice where the image was omitted, with changing background and text colors. |
{{Sitenotice
|type = oswf
|image = [[File:Earth Icon.png|40px|link=GS:OSWF]]
|image bg = palegoldenrod
|text = This is a sitenotice with a type, such as for oswf.
|text color = #fff
|text bg = #DAA520
}}
|
This is a sitenotice with a type, such as for oswf. |