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