2022-01-17 11:50:02 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module ThemingConcern
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2022-02-05 09:58:51 +00:00
|
|
|
def current_flavour
|
2024-04-28 10:08:08 +00:00
|
|
|
@current_flavour ||= [current_user&.setting_flavour, Setting.flavour, 'glitch', 'vanilla'].find { |flavour| Themes.instance.flavours.include?(flavour) }
|
2022-02-05 09:58:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def current_skin
|
2024-04-28 10:08:08 +00:00
|
|
|
@current_skin ||= begin
|
|
|
|
skins = Themes.instance.skins_for(current_flavour)
|
2024-05-01 12:06:09 +00:00
|
|
|
[current_user&.setting_skin, Setting.skin, 'system', 'default'].find { |skin| skins.include?(skin) }
|
2024-04-28 10:08:08 +00:00
|
|
|
end
|
2022-02-05 09:58:51 +00:00
|
|
|
end
|
|
|
|
|
2024-04-27 20:34:41 +00:00
|
|
|
def current_theme
|
|
|
|
# NOTE: this is slightly different from upstream, as it's a derived value used
|
|
|
|
# for the sole purpose of pointing to the appropriate stylesheet pack
|
2024-05-01 12:06:09 +00:00
|
|
|
[current_flavour, current_skin]
|
2022-01-17 11:50:02 +00:00
|
|
|
end
|
|
|
|
end
|