Wiki source code of Skin
Last modified by Eleni Cojocariu on 2026/11/13 12:34
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
![]() |
2.1 | 1 | The [[Skin Module>>doc:extensions:Extension.Skin.Module.WebHome]] is the API Java code uses to find a file inside a skin, following the skin's inheritance. It has nothing to say about how a skin looks. |
| 2 | |||
| 3 | The entry point is the ##SkinManager## component, which hands out a ##Skin## by id, for the current request or for the instance default. A ##Skin## is a ##ResourceRepository##, so it has a parent and resolves a name to a ##Resource##. Every member of the four roles is listed on the [[Skin API>>doc:documentation.xs.dev.skin.api.WebHome]]. The artifact is ##xwiki-platform-skin-api##, whose sources are in {{scm path="xwiki-platform-core/xwiki-platform-skin/xwiki-platform-skin-api"/}}. | ||
| 4 | |||
| 5 | {{plantuml}} | ||
| 6 | @startuml | ||
| 7 | !theme bluegray | ||
![]() |
9.3 | 8 | ' ---- XWiki accessible diagram palette (WCAG 2.1 AA): paste verbatim under |
| 9 | ' !theme bluegray. Canonical copy: xwiki-doc-writing/tools/ in xwiki-dev-llm. | ||
| 10 | skinparam activity { | ||
| 11 | BackgroundColor #0568AE | ||
| 12 | BorderColor #034873 | ||
| 13 | FontColor #FFFFFF | ||
| 14 | StartColor #04538B | ||
| 15 | EndColor #04538B | ||
| 16 | BarColor #5A5A5A | ||
![]() |
9.4 | 17 | ' Diamonds are blue with white text, not light with dark text: a labelled |
| 18 | ' `repeat :x;` takes its fill from DiamondBackgroundColor but its font from | ||
| 19 | ' FontColor above, so a light fill draws that one box white on white, and no | ||
| 20 | ' selector reaches it without reaching the decision diamonds too. | ||
| 21 | DiamondBackgroundColor #0568AE | ||
| 22 | DiamondBorderColor #034873 | ||
| 23 | DiamondFontColor #FFFFFF | ||
![]() |
9.3 | 24 | } |
| 25 | skinparam state { | ||
| 26 | BackgroundColor #0568AE | ||
| 27 | BorderColor #034873 | ||
| 28 | FontColor #FFFFFF | ||
| 29 | AttributeFontColor #FFFFFF | ||
| 30 | StartColor #04538B | ||
| 31 | EndColor #04538B | ||
| 32 | } | ||
| 33 | skinparam class { | ||
| 34 | BackgroundColor #0568AE | ||
| 35 | BorderColor #034873 | ||
| 36 | FontColor #FFFFFF | ||
| 37 | HeaderBackgroundColor #0568AE | ||
| 38 | AttributeFontColor #FFFFFF | ||
| 39 | StereotypeFontColor #262626 | ||
| 40 | } | ||
| 41 | skinparam object { | ||
| 42 | BackgroundColor #0568AE | ||
| 43 | BorderColor #034873 | ||
| 44 | FontColor #FFFFFF | ||
| 45 | AttributeFontColor #FFFFFF | ||
| 46 | StereotypeFontColor #262626 | ||
| 47 | } | ||
| 48 | skinparam participant { | ||
| 49 | BackgroundColor #0568AE | ||
| 50 | BorderColor #034873 | ||
| 51 | FontColor #FFFFFF | ||
| 52 | } | ||
| 53 | skinparam actor { | ||
| 54 | BackgroundColor #F5F5F5 | ||
| 55 | BorderColor #5A5A5A | ||
| 56 | FontColor #262626 | ||
| 57 | } | ||
| 58 | skinparam component { | ||
| 59 | BackgroundColor #0568AE | ||
| 60 | BorderColor #034873 | ||
| 61 | FontColor #FFFFFF | ||
| 62 | } | ||
| 63 | skinparam collections { | ||
| 64 | BackgroundColor #0568AE | ||
| 65 | BorderColor #034873 | ||
| 66 | FontColor #FFFFFF | ||
| 67 | } | ||
| 68 | skinparam queue { | ||
| 69 | BackgroundColor #0568AE | ||
| 70 | BorderColor #034873 | ||
| 71 | FontColor #FFFFFF | ||
| 72 | } | ||
| 73 | skinparam stack { | ||
| 74 | BackgroundColor #0568AE | ||
| 75 | BorderColor #034873 | ||
| 76 | FontColor #FFFFFF | ||
| 77 | } | ||
| 78 | ' database, control, entity, boundary and interface draw their label beside or | ||
| 79 | ' under the icon, on the page, in some diagram types: their text stays dark. | ||
| 80 | skinparam database { | ||
| 81 | BackgroundColor #F5F5F5 | ||
| 82 | BorderColor #5A5A5A | ||
| 83 | FontColor #262626 | ||
| 84 | } | ||
| 85 | skinparam control { | ||
| 86 | BackgroundColor #0568AE | ||
| 87 | BorderColor #034873 | ||
| 88 | FontColor #262626 | ||
| 89 | } | ||
| 90 | skinparam entity { | ||
| 91 | BackgroundColor #0568AE | ||
| 92 | BorderColor #034873 | ||
| 93 | FontColor #262626 | ||
| 94 | } | ||
| 95 | skinparam boundary { | ||
| 96 | BackgroundColor #0568AE | ||
| 97 | BorderColor #034873 | ||
| 98 | FontColor #262626 | ||
| 99 | } | ||
| 100 | skinparam usecase { | ||
| 101 | BackgroundColor #0568AE | ||
| 102 | BorderColor #034873 | ||
| 103 | FontColor #FFFFFF | ||
| 104 | StereotypeFontColor #FFFFFF | ||
| 105 | } | ||
| 106 | skinparam card { | ||
| 107 | BackgroundColor #04538B | ||
| 108 | BorderColor #034873 | ||
| 109 | FontColor #FFFFFF | ||
| 110 | } | ||
| 111 | skinparam note { | ||
| 112 | BackgroundColor #04538B | ||
| 113 | BorderColor #034873 | ||
| 114 | FontColor #FFFFFF | ||
| 115 | } | ||
| 116 | skinparam storage { | ||
| 117 | BackgroundColor #8A4A00 | ||
| 118 | BorderColor #8A4A00 | ||
| 119 | FontColor #FFFFFF | ||
| 120 | } | ||
| 121 | skinparam agent { | ||
| 122 | BackgroundColor #8A4A00 | ||
| 123 | BorderColor #8A4A00 | ||
| 124 | FontColor #FFFFFF | ||
| 125 | } | ||
| 126 | skinparam interface { | ||
| 127 | BackgroundColor #A62222 | ||
| 128 | BorderColor #A62222 | ||
| 129 | FontColor #262626 | ||
| 130 | } | ||
| 131 | skinparam node { | ||
| 132 | BackgroundColor #F5F5F5 | ||
| 133 | BorderColor #5A5A5A | ||
| 134 | FontColor #262626 | ||
| 135 | } | ||
| 136 | skinparam cloud { | ||
| 137 | BackgroundColor #F5F5F5 | ||
| 138 | BorderColor #5A5A5A | ||
| 139 | FontColor #262626 | ||
| 140 | } | ||
| 141 | skinparam artifact { | ||
| 142 | BackgroundColor #F5F5F5 | ||
| 143 | BorderColor #5A5A5A | ||
| 144 | FontColor #262626 | ||
| 145 | } | ||
| 146 | skinparam file { | ||
| 147 | BackgroundColor #F5F5F5 | ||
| 148 | BorderColor #5A5A5A | ||
| 149 | FontColor #262626 | ||
| 150 | } | ||
| 151 | skinparam rectangle { | ||
| 152 | BackgroundColor #FFFFFF | ||
| 153 | BorderColor #5A5A5A | ||
| 154 | FontColor #262626 | ||
| 155 | StereotypeFontColor #0568AE | ||
| 156 | } | ||
| 157 | skinparam folder { | ||
| 158 | BackgroundColor #F5F5F5 | ||
| 159 | BorderColor #8A4A00 | ||
| 160 | FontColor #8A4A00 | ||
| 161 | } | ||
| 162 | skinparam frame { | ||
| 163 | BackgroundColor #F5F5F5 | ||
| 164 | BorderColor #04538B | ||
| 165 | FontColor #04538B | ||
| 166 | } | ||
| 167 | skinparam package { | ||
| 168 | BackgroundColor #FFFFFF | ||
| 169 | BorderColor #0568AE | ||
| 170 | FontColor #262626 | ||
| 171 | } | ||
| 172 | skinparam partition { | ||
| 173 | BackgroundColor #FFFFFF | ||
| 174 | BorderColor #0568AE | ||
| 175 | FontColor #0568AE | ||
| 176 | } | ||
| 177 | skinparam swimlane { | ||
| 178 | BorderColor #0568AE | ||
| 179 | TitleBackgroundColor #F5F5F5 | ||
| 180 | TitleFontColor #0568AE | ||
| 181 | } | ||
| 182 | skinparam sequence { | ||
| 183 | BoxBackgroundColor #F5F5F5 | ||
| 184 | BoxBorderColor #5A5A5A | ||
| 185 | BoxFontColor #262626 | ||
| 186 | DelayFontColor #262626 | ||
| 187 | GroupBorderColor #5A5A5A | ||
| 188 | GroupFontColor #262626 | ||
| 189 | LifeLineBorderColor #5A5A5A | ||
| 190 | LifeLineBackgroundColor #F5F5F5 | ||
| 191 | TitleFontColor #0568AE | ||
| 192 | StartColor #0568AE | ||
| 193 | EndColor #0568AE | ||
| 194 | BorderColor #0568AE | ||
| 195 | } | ||
| 196 | skinparam arrow { | ||
| 197 | Color #0568AE | ||
| 198 | FontColor #262626 | ||
| 199 | } | ||
| 200 | skinparam legend { | ||
| 201 | BackgroundColor #F5F5F5 | ||
| 202 | BorderColor #5A5A5A | ||
| 203 | FontColor #262626 | ||
| 204 | } | ||
| 205 | skinparam stereotype { | ||
| 206 | CBackgroundColor #F5F5F5 | ||
| 207 | CBorderColor #5A5A5A | ||
| 208 | ABackgroundColor #F5F5F5 | ||
| 209 | ABorderColor #5A5A5A | ||
| 210 | IBackgroundColor #F5F5F5 | ||
| 211 | IBorderColor #5A5A5A | ||
| 212 | EBackgroundColor #F5F5F5 | ||
| 213 | EBorderColor #5A5A5A | ||
| 214 | NBackgroundColor #F5F5F5 | ||
| 215 | NBorderColor #5A5A5A | ||
| 216 | } | ||
| 217 | skinparam ArrowColor #0568AE | ||
| 218 | ' titleFontColor only: the nested `skinparam title { BackgroundColor }` form | ||
| 219 | ' leaks its background onto every element in the diagram. | ||
| 220 | skinparam titleFontColor #0568AE | ||
| 221 | skinparam titleBorderColor #5A5A5A | ||
| 222 | ' Links otherwise take bluegray's white root colour, unreadable on a light fill. | ||
| 223 | <style> | ||
| 224 | root { | ||
| 225 | HyperLinkColor #0568AE | ||
| 226 | } | ||
| 227 | element { | ||
| 228 | HyperLinkColor #FFFFFF | ||
| 229 | } | ||
| 230 | actor, artifact, boundary, cloud, control, database, entity, file, folder, frame, interface, | ||
| 231 | legend, node, package, rectangle { | ||
| 232 | HyperLinkColor #0568AE | ||
| 233 | } | ||
| 234 | </style> | ||
| 235 | ' ---- end XWiki accessible diagram palette ---- | ||
![]() |
2.1 | 236 | skinparam componentStyle rectangle |
| 237 | |||
| 238 | component "**SkinManager**\nthe component to inject" as SM | ||
| 239 | component "**Skin**\none skin" as SK | ||
| 240 | component "**ResourceRepository**\nsomewhere to look a name up" as RR | ||
| 241 | component "**Resource**\none file of a skin" as RES | ||
| 242 | |||
| 243 | SM --> SK : getSkin, getCurrentSkin,\ngetDefaultSkin, getDefaultParentSkin | ||
| 244 | RR <|-- SK : a skin is a\nresource repository | ||
| 245 | RR --> RR : parent, walked when\nthe name is not here | ||
| 246 | RR --> RES : getResource walks the chain,\ngetLocalResource does not | ||
| 247 | RES --> RR : getRepository, the skin\nthe file came from | ||
| 248 | @enduml | ||
| 249 | {{/plantuml}} | ||
| 250 | |||
![]() |
5.5 | 251 | The [[three kinds of skin>>doc:documentation.xs.admin.skins.available.WebHome]] each resolve to a class: an id that resolves to an existing page gives a ##WikiSkin##, whose ##XWiki.XWikiSkins## object holds the skin's properties; a ##skins/## folder of the environment holding a ##skin.properties## gives an ##EnvironmentSkin##; anything else falls back to a ##ClassLoaderSkin##, which is how a skin shipped inside a JAR is found. A wiki skin reads a file from a template override object, then from a property of its skin object, then from an attachment of the same page. |
![]() |
2.1 | 252 | |
![]() |
5.1 | 253 | A lookup starts in the skin itself and then walks the parent chain, and the first repository holding the name wins. A skin that names no parent falls back to the default parent skin. Only a filesystem or JAR skin can opt out of that fallback, by setting an empty ##parent## in its ##skin.properties##; a wiki skin whose ##baseskin## is left empty still gets the default parent. |
![]() |
2.1 | 254 | |
| 255 | This module declares the roles and nothing else, and ships no ##components.txt##. The implementations are in ##xwiki-platform-oldcore##, package ##com.xpn.xwiki.internal.skin##, which is where to read how a lookup behaves. | ||
| 256 | |||
![]() |
6.1 | 257 | Skin extensions are a different mechanism, how a page contributes CSS or JavaScript to the response; they are documented on [[Skin Extensions>>doc:xwiki:documentation.xs.dev.skin-extensions.WebHome]]. Only their two roles are declared in this artifact. |
