Class: MissionControl::Jobs::Theme::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/mission_control/jobs/theme/configuration.rb

Overview

Hold user-configurable options for the theme middleware.

See Also:

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
"mc_jobs_color_scheme"
DEFAULT_THEME =
:malachite
DEFAULT_COLOR_SCHEME =
:auto

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_schemeSymbol

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.

Returns:

  • (Symbol)

    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_switcherBoolean

Returns whether to inject the color scheme switcher UI control (default: true).

Returns:

  • (Boolean)

    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_highlightingBoolean

Returns whether to inject Prism.js syntax highlighting for JSON payloads (default: true).

Returns:

  • (Boolean)

    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

#themeSymbol

Returns the active theme family (must be listed in THEMES).

Returns:

  • (Symbol)

    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