Class: Avo::Configuration::Branding

Inherits:
Object
  • Object
show all
Defined in:
lib/avo/configuration/branding.rb

Instance Method Summary collapse

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 = 
  @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_colorsObject



46
47
48
# File 'lib/avo/configuration/branding.rb', line 46

def chart_colors
  @chart_colors || @default_chart_colors
end

#css_colorsObject



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

#faviconObject



50
51
52
# File 'lib/avo/configuration/branding.rb', line 50

def favicon
  @favicon || @default_favicon
end

#logoObject



34
35
36
# File 'lib/avo/configuration/branding.rb', line 34

def 
  @logo || @default_logo
end

#logomarkObject



38
39
40
# File 'lib/avo/configuration/branding.rb', line 38

def logomark
  @logomark || @default_logomark
end

#placeholderObject



42
43
44
# File 'lib/avo/configuration/branding.rb', line 42

def placeholder
  @placeholder || @default_placeholder
end