1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00

(bug) fix syntax error in stylesheet

This commit is contained in:
Karen 2023-02-02 13:38:55 +01:00 committed by Sylvain
parent 10473182d4
commit 6217e9e6b1
2 changed files with 21 additions and 6 deletions

View File

@ -4,12 +4,11 @@
# a picture for the background of the user's profile.
# There's only one stylesheet record in the database, which is updated on each colour change.
class Stylesheet < ApplicationRecord
# brightness limits to change the font color to black or white
BRIGHTNESS_HIGH_LIMIT = 160
BRIGHTNESS_LOW_LIMIT = 40
validates_presence_of :contents
validates :contents, presence: true
## ===== COMMON =====
@ -41,6 +40,10 @@ class Stylesheet < ApplicationRecord
Setting.get('secondary_color')
end
def self.primary_lightest
Stylesheet.primary_light.paint.lighten(60)
end
def self.primary_light
Stylesheet.primary.paint.lighten(10)
end
@ -49,6 +52,14 @@ class Stylesheet < ApplicationRecord
Stylesheet.primary.paint.darken(20)
end
def self.primary_darkest
Stylesheet.primary_dark.paint.darken(20)
end
def self.secondary_lightest
Stylesheet.secondary_light.paint.lighten(60)
end
def self.secondary_light
Stylesheet.secondary.paint.lighten(10)
end
@ -57,6 +68,10 @@ class Stylesheet < ApplicationRecord
Stylesheet.secondary.paint.darken(20)
end
def self.secondary_darkest
Stylesheet.secondary_dark.paint.darken(20)
end
def self.primary_with_alpha(alpha)
Stylesheet.primary.paint.to_rgb.insert(3, 'a').insert(-2, ", #{alpha}")
end

View File

@ -13,17 +13,17 @@ $secondary-text-color: <%= Stylesheet.secondary_text_color %> !default;
$primary-decoration-color: <%= Stylesheet.primary_decoration_color %> !default;
:root {
--main-lightest: lighten(<%= Stylesheet.primary_light %>, 20%) !important;
--main-lightest: <%= Stylesheet.primary_lightest %> !important;
--main-light: <%= Stylesheet.primary_light %> !important;
--main: <%= Stylesheet.primary %> !important;
--main-dark: <%= Stylesheet.primary_dark %> !important;
--main-darkest: darken(<%= Stylesheet.primary_dark %>, 20%) !important;
--main-darkest: <%= Stylesheet.primary_darkest %> !important;
--secondary-lightest: lighten(<%= Stylesheet.secondary_light %>, 20%) !important;
--secondary-lightest: <%= Stylesheet.secondary_lightest %> !important;
--secondary-light: <%= Stylesheet.secondary_light %> !important;
--secondary: <%= Stylesheet.secondary %> !important;
--secondary-dark: <%= Stylesheet.secondary_dark %> !important;
--secondary-darkest: darken(<%= Stylesheet.secondary_dark %>, 20%) !important;
--secondary-darkest: <%= Stylesheet.secondary_darkest %> !important;
--main-text-color: <%= Stylesheet.primary_text_color %> !important;
--secondary-text-color: <%= Stylesheet.secondary_text_color %> !important;