Class: Avo::Configuration::Branding
- Inherits:
-
Object
- Object
- Avo::Configuration::Branding
- Defined in:
- lib/avo/configuration/branding.rb
Instance Method Summary collapse
- #chart_colors ⇒ Object
- #css_colors ⇒ Object
- #favicon ⇒ Object
-
#initialize(colors: nil, chart_colors: nil, logo: nil, logomark: nil, placeholder: nil, favicon: nil) ⇒ Branding
constructor
A new instance of Branding.
- #logo ⇒ Object
- #logomark ⇒ Object
- #placeholder ⇒ Object
Constructor Details
#initialize(colors: nil, chart_colors: nil, logo: nil, logomark: nil, placeholder: nil, favicon: nil) ⇒ Branding
Returns a new instance of Branding.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/avo/configuration/branding.rb', line 2 def initialize(colors: nil, chart_colors: nil, logo: nil, logomark: nil, placeholder: nil, favicon: nil) @colors = colors || {} @chart_colors = chart_colors @logo = logo @logomark = logomark @placeholder = placeholder @favicon = favicon @default_colors = { :background => "#F6F6F7", 100 => "206 231 248", 400 => "57 158 229", 500 => "8 134 222", 600 => "6 107 178" } @default_chart_colors = ["#0B8AE2", "#34C683", "#FFBE4F", "#FF7676", "#2AB1EE", "#34C6A8", "#EC8CFF", "#80FF91", "#FFFC38", "#1BDBE8"] @default_logo = "/avo-assets/logo.png" @default_logomark = "/avo-assets/logomark.png" @default_placeholder = "/avo-assets/placeholder.svg" @default_favicon = "/avo-assets/favicon.ico" end |
Instance Method Details
#chart_colors ⇒ Object
46 47 48 |
# File 'lib/avo/configuration/branding.rb', line 46 def chart_colors @chart_colors || @default_chart_colors end |
#css_colors ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/avo/configuration/branding.rb', line 24 def css_colors rgb_colors.map do |color, value| if color == :background "--color-application-#{color}: #{value};" else "--color-primary-#{color}: #{value};" end end.join("\n") end |
#favicon ⇒ Object
50 51 52 |
# File 'lib/avo/configuration/branding.rb', line 50 def favicon @favicon || @default_favicon end |
#logo ⇒ Object
34 35 36 |
# File 'lib/avo/configuration/branding.rb', line 34 def logo @logo || @default_logo end |
#logomark ⇒ Object
38 39 40 |
# File 'lib/avo/configuration/branding.rb', line 38 def logomark @logomark || @default_logomark end |
#placeholder ⇒ Object
42 43 44 |
# File 'lib/avo/configuration/branding.rb', line 42 def placeholder @placeholder || @default_placeholder end |