Class: Primer::Classify::FunctionalTextColors

Inherits:
FunctionalColors show all
Defined in:
app/lib/primer/classify/functional_text_colors.rb

Overview

Constant Summary collapse

FUNCTIONAL_OPTIONS =
{
  primary: :text_primary,
  secondary: :text_secondary,
  tertiary: :text_tertiary,
  link: :text_link,
  success: :text_success,
  warning: :text_warning,
  danger: :text_danger,
  white: :text_white,
  inverse: :text_inverse
}.freeze
MAPPINGS =

colors mapping to ‘nil` will preserve the old classes. e.g. `text: :orange` will generate `text-orange`.

{
  gray_dark: FUNCTIONAL_OPTIONS[:primary],
  gray: FUNCTIONAL_OPTIONS[:secondary],
  gray_light: FUNCTIONAL_OPTIONS[:tertiary],
  blue: FUNCTIONAL_OPTIONS[:link],
  green: FUNCTIONAL_OPTIONS[:success],
  yellow: FUNCTIONAL_OPTIONS[:warning],
  red: FUNCTIONAL_OPTIONS[:danger],
  white: FUNCTIONAL_OPTIONS[:white]
}.freeze
OPTIONS =
[
  :icon_primary,
  :icon_secondary,
  :icon_tertiary,
  :icon_info,
  :icon_success,
  :icon_warning,
  :icon_danger,
  *FUNCTIONAL_OPTIONS.values
].freeze
OPTIONS_WITHOUT_MAPPINGS =
[:black, :orange, :orange_light, :purple, :pink, :inherit].freeze
DEPRECATED_OPTIONS =
[*MAPPINGS.keys, *OPTIONS_WITHOUT_MAPPINGS].freeze

Class Method Summary collapse

Class Method Details

.color(val) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
# File 'app/lib/primer/classify/functional_text_colors.rb', line 47

def color(val)
  functional_color(
    key: "color",
    value: val,
    mappings: MAPPINGS,
    non_functional_prefix: "text",
    functional_prefix: "color",
    number_prefix: "color",
    functional_options: OPTIONS,
    options_without_mappigs: OPTIONS_WITHOUT_MAPPINGS
  )
end