Class: RailsSiteEngine::Theme

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_site_engine/theme.rb

Constant Summary collapse

DEFAULT_DAISYUI_THEME =
"corporate"

Instance Method Summary collapse

Constructor Details

#initialize(path: nil, host_config: RailsSiteEngine::SiteEngineConfig.new) ⇒ Theme

Returns a new instance of Theme.



8
9
10
11
12
13
14
15
16
17
# File 'lib/rails_site_engine/theme.rb', line 8

def initialize(
  path: nil,
  host_config: RailsSiteEngine::SiteEngineConfig.new
)
  if path
    @override_path = Pathname.new(path)
  else
    @override_path = host_config.override_theme_path
  end
end

Instance Method Details

#daisyui_dark_mode_enabled? ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/rails_site_engine/theme.rb', line 27

def daisyui_dark_mode_enabled?
  daisyui_dark_theme.present?
end

#daisyui_dark_theme ⇒ Object



23
24
25
# File 'lib/rails_site_engine/theme.rb', line 23

def daisyui_dark_theme
  config.dig("daisyui", "dark_theme").to_s.strip.presence
end

#daisyui_light_theme ⇒ Object



19
20
21
# File 'lib/rails_site_engine/theme.rb', line 19

def daisyui_light_theme
  config.dig("daisyui", "theme").to_s.strip.presence || DEFAULT_DAISYUI_THEME
end

#daisyui_theme ⇒ Object



31
32
33
# File 'lib/rails_site_engine/theme.rb', line 31

def daisyui_theme
  daisyui_light_theme
end