Custom themes - muyjohno/desperado GitHub Wiki
Creating a theme is pretty straightforward!
Add the theme to the theme options
In app/models/league.rb
, add a symbolised slug (i.e. preceded by a colon) to the theme
enum array
enum theme: [:default, :my_new_theme]
Now you can select that theme through the league options of your local instance.
Apply some styles
There won't be any visible difference, but the app will add your theme slug to the body
's classes.
Create a SASS file in app/assets/stylesheets/themes
which by convention you should give the same name as your theme (e.g. my_new_theme.sass
)
Then add your styles, making sure to only apply them to body.[your_theme]
:
body.my_new_theme
color: red
You can use the simple "classic" theme as a starting example.
Add a name
To give the theme a name that will appear in the league settings dropdown, add a line to the locale file in locales/en.yml
and any other locales that may exist. The items in this YAML file are key/value pairs for text used around the app. Your key should be "theme_" and then your theme slug as it was defined in the league.rb
enum and your value should be the text that you want to appear, e.g.:
en:
...
theme_my_new_theme: "My New Theme"
Contribute
If you'd like others to have access to the theme, consider creating a pull-request to have it merged into the master repo!
What's SASS?
It's great! It's a cleaner syntax for CSS. Learn more at http://sass-lang.com/guide