Class: MissionControl::Jobs::Theme::Configuration
- Inherits:
-
Object
- Object
- MissionControl::Jobs::Theme::Configuration
- Defined in:
- lib/mission_control/jobs/theme/configuration.rb
Overview
Hold user-configurable options for the theme middleware.
Constant Summary collapse
- THEMES =
Available theme families. Each entry must have matching {name}_light.min.css and {name}_dark.min.css files under
app/assets/stylesheets/mission_control/theme/. %i[malachite].freeze
- COLOR_SCHEMES =
%i[light dark].freeze
- COOKIE_NAME =
"mc_jobs_color_scheme"- DEFAULT_THEME =
:malachite- DEFAULT_COLOR_SCHEME =
:auto
Instance Attribute Summary collapse
-
#color_scheme ⇒ Symbol
The active color scheme (
:auto,:light, or:dark). -
#color_scheme_switcher ⇒ Boolean
Whether to inject the color scheme switcher UI control (default:
true). -
#syntax_highlighting ⇒ Boolean
Whether to inject Prism.js syntax highlighting for JSON payloads (default:
true). -
#theme ⇒ Symbol
The active theme family (must be listed in THEMES).
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
37 38 39 40 41 42 |
# File 'lib/mission_control/jobs/theme/configuration.rb', line 37 def initialize @color_scheme = DEFAULT_COLOR_SCHEME @color_scheme_switcher = true @syntax_highlighting = true @theme = DEFAULT_THEME end |
Instance Attribute Details
#color_scheme ⇒ Symbol
Returns the active color scheme (:auto, :light, or :dark). :auto injects both light and dark stylesheets with prefers-color-scheme media queries so the browser picks the one matching the OS preference.
24 25 26 |
# File 'lib/mission_control/jobs/theme/configuration.rb', line 24 def color_scheme @color_scheme end |
#color_scheme_switcher ⇒ Boolean
Returns whether to inject the color scheme switcher UI control (default: true).
28 29 30 |
# File 'lib/mission_control/jobs/theme/configuration.rb', line 28 def color_scheme_switcher @color_scheme_switcher end |
#syntax_highlighting ⇒ Boolean
Returns whether to inject Prism.js syntax highlighting for JSON payloads (default: true).
32 33 34 |
# File 'lib/mission_control/jobs/theme/configuration.rb', line 32 def syntax_highlighting @syntax_highlighting end |
#theme ⇒ Symbol
Returns the active theme family (must be listed in THEMES).
35 36 37 |
# File 'lib/mission_control/jobs/theme/configuration.rb', line 35 def theme @theme end |