2022-01-17 12:50:02 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module ThemingConcern
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2022-02-05 10:58:51 +01:00
|
|
|
def current_flavour
|
2024-04-28 12:08:08 +02:00
|
|
|
@current_flavour ||= [current_user&.setting_flavour, Setting.flavour, 'glitch', 'vanilla'].find { |flavour| Themes.instance.flavours.include?(flavour) }
|
2022-02-05 10:58:51 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def current_skin
|
2024-04-28 12:08:08 +02:00
|
|
|
@current_skin ||= begin
|
|
|
|
skins = Themes.instance.skins_for(current_flavour)
|
2024-05-01 14:06:09 +02:00
|
|
|
[current_user&.setting_skin, Setting.skin, 'system', 'default'].find { |skin| skins.include?(skin) }
|
2024-04-28 12:08:08 +02:00
|
|
|
end
|
2022-02-05 10:58:51 +01:00
|
|
|
end
|
|
|
|
|
2024-04-27 22:34:41 +02: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 14:06:09 +02:00
|
|
|
[current_flavour, current_skin]
|
2022-01-17 12:50:02 +01:00
|
|
|
end
|
|
|
|
end
|