Module: Tailwinds::BackgroundHelper
- Included in:
- NavbarComponent
- Defined in:
- app/components/tailwinds/navbar_component.rb
Overview
Background helper module
Constant Summary collapse
- CSS_COLORS =
%i[aqua black blue fuchsia gray green lime maroon navy olive orange purple red silver teal white yellow].freeze
- MIN_INTENSITY =
100
- MAX_INTENSITY =
950
- DEFAULT_BACKGROUND_COLOR =
:purple
- DEFAULT_BACKGROUND_INTENSITY =
700
Class Method Summary collapse
Class Method Details
.background(options) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/components/tailwinds/navbar_component.rb', line 14 def self.background() color = .dig(:background, :color) || DEFAULT_BACKGROUND_COLOR intensity = .dig(:background, :intensity) || DEFAULT_BACKGROUND_INTENSITY unless (MIN_INTENSITY..MAX_INTENSITY).cover?(intensity) raise "Navigation Background Color intensity should be between #{MIN_INTENSITY} and #{MAX_INTENSITY}" end if color.in? CSS_COLORS "#{color}-#{intensity}" else "[#{color}]" end end |