Class ThemeGenerator
Class to generate a CSS files from profile settings, works as a templating system. Templates files are .php files that return a string of css. The array $colors will be sent to the files with generated keys based on $settingsList.
For example, because 'text' is a key in $settingsList, $colors[text] $colors[dark_text] $colors[darker_text] $colors[bright_text] $colors[brighter_text] $colors[light_text] $colors[lighter_text] $colors[opaque_text]
Are all avaliable to the templates. light and lighter keys are 'smart'
meaning it will appear brighter on dark themes and darker on dark themes.
In addition, the keys
$colors[smart_text] $colors[smart_text2]
will adapt based on the difference in contrast between highlight1 and highlight2
with text respectively
An entry in the color array automatically adds the !important tag and a
semicolon. Example Template entry:
#content a:hover { color: $colors[darker_link] }
#content span { background: $colors[highlight2] color: $colors[smart_text2]
}
To use key that doesnt have the !important tag added, append _hex to the key $colors[text_hex], $colors[darker_hex]
Located at x2engine/protected/components/ThemeGenerator/ThemeGenerator.php
public static
|
|
public static
|
|
public static
array
|
#
generatePalette( mixed $preferences, mixed $refresh = false )
Populates the array with different color option |
public static
array
|
#
formatColorArray( array $colors )
Formats a color array to be CSS-ready by adding important tags and adding a key appended with hex that does not have the important tags |
public static
|
|
public static
|
|
public static
|
|
public static
|
#
renderThemeColorSelector( mixed $label, mixed $key, mixed $value, mixed $htmlOptions = array (), mixed $disabled = false )
|
public static
|
#
renderSettings( )
Renders the settings for the profile page based on the $settingsList array TODO: Move to a class for rendering the theme settings. |
public static
|
|
public static
|
|
public static
|
|
public static
|
string |
TEMPLATE_PATH
|
'components/ThemeGenerator/templates' |
#
Path to the folder of templates. |
public static
name
|
$defaultLight | 'Default' |
#
of default light theme |
public static
name
|
$defaultDark | 'Terminal' |
#
of default dark theme |