Module: Card::Set::TypePlusRight::BootswatchSkin::Colors
- Extended by:
- Card::Set
- Defined in:
- platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb
Overview
Set: All “+Colors” cards on “BootswatchSkin” cards
Defined Under Namespace
Modules: HtmlFormat
Constant Summary
collapse
- VARIABLE_NAMES =
{
colors: %i[blue indigo purple pink red orange yellow green teal cyan black white
gray-100 gray-200 gray-300 gray-400 gray-500
gray-600 gray-700 gray-800 gray-900],
theme_colors: %i[primary secondary success info warning danger light dark
body-bg body-color]
}.freeze
Constants included
from Helpers
Helpers::SET_PATTERN_TEST_REGEXP
Constants included
from Event::Api
Event::Api::OPTIONS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Card::Set
reset
Methods included from I18nScope
#mod_name, #scope
Methods included from Registrar
#extended, #finalize_load, #process_base_modules, #register_set
Methods included from Helpers
#format_module, #format_modules, #method_missing, #modules, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscored_name
#assign_type, #attachment, #define_set_from_error, #ensure_set, #setting_opts, #stage_method
Methods included from Format
#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name
#include_set, #include_set_formats
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
#event
Class Method Details
.source_location ⇒ Object
7
|
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb', line 7
def self.source_location; "/Users/ethan/dev/decko/gem/mod/bootstrap/set/type_plus_right/bootswatch_skin/colors.rb"; end
|
Instance Method Details
#bootstrap_variables_scss ⇒ Object
51
52
53
|
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb', line 51
def bootstrap_variables_scss
@bootstrap_variables_scss ||= left.read_bootstrap_variables
end
|
55
56
57
|
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb', line 55
def colors
@colors ||= variable_group_with_values :colors
end
|
#default_value_from_bootstrap(name) ⇒ Object
47
48
49
|
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb', line 47
def default_value_from_bootstrap name
value_from_scss name, bootstrap_variables_scss
end
|
#definition_regex(name) ⇒ Object
43
44
45
|
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb', line 43
def definition_regex name
/^(?<before>\s*\$#{name}:\s*)(?<value>.+?)(?<after> !default;)$/
end
|
#event: translate_variables_to_scss ⇒ Object
123
124
125
126
|
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb', line 123
event :translate_variables_to_scss, :prepare_to_validate, on: :update do
replace_values :colors
replace_values :theme_colors
end
|
#ok_to_create ⇒ Object
73
74
75
|
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb', line 73
def ok_to_create
left.parent? && super
end
|
#ok_to_update ⇒ Object
77
78
79
|
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb', line 77
def ok_to_update
left.parent? && super
end
|
#theme_colors ⇒ Object
59
60
61
|
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb', line 59
def theme_colors
@theme_colors ||= variable_group_with_values :theme_colors
end
|
#value_from_scss(name, source) ⇒ Object
31
32
33
34
35
|
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb', line 31
def value_from_scss name, source
name = name.to_s
name = name[1..-1] if name.start_with?("$")
source.match(definition_regex(name))&.capture(:value)
end
|
#value_from_variables_card(name) ⇒ Object
37
38
39
40
41
|
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb', line 37
def value_from_variables_card name
return unless (var_card = left.variables_card) && var_card.content.present?
value_from_scss name, var_card.content
end
|
#variable_group_with_values(group) ⇒ Object
63
64
65
66
67
|
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb', line 63
def variable_group_with_values group
VARIABLE_NAMES[group].each_with_object({}) do |name, h|
h[name] = variable_value name
end
end
|
#variable_value(name) ⇒ Object
25
26
27
28
29
|
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb', line 25
def variable_value name
value_from_scss(name, content) ||
value_from_variables_card(name) ||
default_value_from_bootstrap(name)
end
|
#virtual? ⇒ Boolean
69
70
71
|
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/type_plus_right/bootswatch_skin/colors.rb', line 69
def virtual?
new?
end
|