Class: MtgCardMaker::ColorScheme
- Inherits:
-
Object
- Object
- MtgCardMaker::ColorScheme
- Defined in:
- lib/mtg_card_maker/color_scheme.rb
Overview
Unified color scheme system for MTG cards that provides predefined color schemes for different MTG colors and card types. This class replaces multiple separate color classes with a single configurable system that includes gradients, metallic effects, and consistent color palettes.
Constant Summary collapse
- SCHEMES =
Predefined color schemes for all MTG colors and card types
{ colorless: { frame_gradient: ['#8B8B8B', '#6B6B6B', '#4A4A4A'], name_gradient: ['#F5F5F5', '#E8E8E8', '#D4D4D4'], description_gradient: ['#F5F5F5', '#E8E8E8', '#D4D4D4'], card_gradient: ['#3D3D3D', '#111', '#1A1A1A'], primary: '#8B8B8B', background: '#E8E8E8', border: '#8B8B8B', text: '#111', metallic_highlight: ['#FFFFFF', '#E0E0E0', '#8B8B8B'], metallic_shadow: ['#B0B0B0', '#8B8B8B', '#6B6B6B'], metallic_pattern: ['#F5F5F5', '#B0B0B0'] }, white: { frame_gradient: ['#FFF9C4', '#F5F5F5', '#BDB76B'], name_gradient: ['#FFFFFF', '#FFF9C4', '#E0E0E0'], description_gradient: ['#FFFFFF', '#F5F5F5', '#E0E0E0'], card_gradient: ['#D7CCC8', '#BCAAA4', '#8D6E63'], primary: '#8B8B8B', background: '#FFFFFF', border: '#F5F5F5', text: '#111' }, blue: { frame_gradient: ['#42A5F5', '#1565C0', '#263238'], name_gradient: ['#E3F2FD', '#BBDEFB', '#90CAF9'], description_gradient: ['#F3F8FF', '#E3F2FD', '#BBDEFB'], card_gradient: ['#546E7A', '#37474F', '#263238'], primary: '#42A5F5', background: '#E3F2FD', border: '#1565C0', text: '#111' }, black: { frame_gradient: ['#424242', '#212121', '#000'], name_gradient: ['#E0E0E0', '#BDBDBD', '#9E9E9E'], description_gradient: ['#F5F5F5', '#E0E0E0', '#BDBDBD'], card_gradient: ['#424242', '#212121', '#000'], primary: '#424242', background: '#E0E0E0', border: '#212121', text: '#111' }, red: { frame_gradient: ['#F44336', '#D32F2F', '#B71C1C'], name_gradient: ['#FFEBEE', '#FFCDD2', '#EF9A9A'], description_gradient: ['#FFEBEE', '#FFCDD2', '#EF9A9A'], card_gradient: ['#8D6E63', '#6D4C41', '#4E342E'], primary: '#F44336', background: '#FFEBEE', border: '#D32F2F', text: '#111' }, green: { frame_gradient: ['#4CAF50', '#388E3C', '#2E7D32'], name_gradient: ['#E8F5E8', '#C8E6C9', '#A5D6A7'], description_gradient: ['#F1F8E9', '#E8F5E8', '#C8E6C9'], card_gradient: ['#6D4C41', '#5D4037', '#4E342E'], primary: '#4CAF50', background: '#E8F5E8', border: '#388E3C', text: '#111' }, gold: { frame_gradient: ['#FFD700', '#FFA500', '#FF8C00'], name_gradient: ['#F5DEB3', '#E1C16E', '#C9A13B'], description_gradient: ['#FFF8DC', '#FFE4B5', '#FFDAB9'], card_gradient: ['#8B7355', '#6B4423', '#4A2C0A'], primary: '#FFD700', background: '#FFF8DC', border: '#FFA500', text: '#111', metallic_highlight: ['#FFFF99', '#FFD700', '#FFA500'], metallic_shadow: ['#B8860B', '#8B6914', '#654321'], metallic_pattern: ['#FFFACD', '#DAA520'] }, artifact: { frame_gradient: ['#D2B48C', '#BC8F8F', '#A0522D'], name_gradient: ['#F5F5DC', '#DEB887', '#CD853F'], description_gradient: ['#F5F5DC', '#DEB887', '#CD853F'], card_gradient: ['#8B7355', '#6B4423', '#4A2C0A'], primary: '#D2B48C', background: '#F5F5DC', border: '#BC8F8F', text: '#111' } }.freeze
Instance Attribute Summary collapse
-
#config ⇒ Hash
readonly
The configuration for the current color scheme.
-
#scheme_name ⇒ Symbol
readonly
The name of the current color scheme.
Class Method Summary collapse
-
.artifact ⇒ ColorScheme
An artifact color scheme.
-
.black ⇒ ColorScheme
A black color scheme.
-
.blue ⇒ ColorScheme
A blue color scheme.
-
.colorless ⇒ ColorScheme
Convenience methods for backward compatibility.
-
.gold ⇒ ColorScheme
A gold color scheme.
-
.green ⇒ ColorScheme
A green color scheme.
-
.red ⇒ ColorScheme
A red color scheme.
-
.silver ⇒ ColorScheme
A silver color scheme.
-
.white ⇒ ColorScheme
A white color scheme.
Instance Method Summary collapse
- #background_color ⇒ Object
- #border_color ⇒ Object
- #card_gradient_colors ⇒ Object
- #card_gradient_end ⇒ Object
- #card_gradient_middle ⇒ Object
-
#card_gradient_start ⇒ Object
Card gradient colors.
- #description_gradient_colors ⇒ Object
- #description_gradient_end ⇒ Object
- #description_gradient_middle ⇒ Object
-
#description_gradient_start ⇒ Object
Description gradient colors.
-
#frame_gradient_colors ⇒ Array<String>
All frame gradient colors from outer to inner.
-
#frame_gradient_end ⇒ String
The frame gradient color.
-
#frame_gradient_middle ⇒ String
The middle frame gradient color.
-
#frame_gradient_start ⇒ String
Frame gradient colors (outer to inner).
-
#initialize(scheme_name = :colorless) ⇒ ColorScheme
constructor
Initialize a new color scheme with the given name.
- #metallic_highlight_end ⇒ Object
- #metallic_highlight_middle ⇒ Object
-
#metallic_highlight_start ⇒ Object
Metallic highlight gradient colors.
- #metallic_pattern_dark ⇒ Object
-
#metallic_pattern_light ⇒ Object
Metallic pattern colors.
- #metallic_shadow_end ⇒ Object
- #metallic_shadow_middle ⇒ Object
-
#metallic_shadow_start ⇒ Object
Metallic shadow gradient colors.
-
#name_gradient_colors ⇒ Array<String>
All name gradient colors from light to dark.
-
#name_gradient_end ⇒ String
The darkest name gradient color.
-
#name_gradient_middle ⇒ String
The middle name gradient color.
-
#name_gradient_start ⇒ String
Name gradient colors (light to dark).
-
#primary_color ⇒ Object
Primary colors.
- #text_color ⇒ Object
Constructor Details
#initialize(scheme_name = :colorless) ⇒ ColorScheme
Initialize a new color scheme with the given name
123 124 125 126 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 123 def initialize(scheme_name = :colorless) @scheme_name = scheme_name.to_sym @config = SCHEMES[@scheme_name] || SCHEMES[:colorless] end |
Instance Attribute Details
#config ⇒ Hash (readonly)
Returns the configuration for the current color scheme.
116 117 118 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 116 def config @config end |
#scheme_name ⇒ Symbol (readonly)
Returns the name of the current color scheme.
113 114 115 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 113 def scheme_name @scheme_name end |
Class Method Details
.artifact ⇒ ColorScheme
Returns an artifact color scheme.
296 297 298 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 296 def self.artifact new(:artifact) end |
.black ⇒ ColorScheme
Returns a black color scheme.
276 277 278 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 276 def self.black new(:black) end |
.blue ⇒ ColorScheme
Returns a blue color scheme.
271 272 273 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 271 def self.blue new(:blue) end |
.colorless ⇒ ColorScheme
Convenience methods for backward compatibility
261 262 263 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 261 def self.colorless new(:colorless) end |
.gold ⇒ ColorScheme
Returns a gold color scheme.
291 292 293 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 291 def self.gold new(:gold) end |
.green ⇒ ColorScheme
Returns a green color scheme.
286 287 288 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 286 def self.green new(:green) end |
.red ⇒ ColorScheme
Returns a red color scheme.
281 282 283 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 281 def self.red new(:red) end |
.silver ⇒ ColorScheme
Returns a silver color scheme.
301 302 303 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 301 def self.silver new(:silver) end |
.white ⇒ ColorScheme
Returns a white color scheme.
266 267 268 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 266 def self.white new(:white) end |
Instance Method Details
#background_color ⇒ Object
211 212 213 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 211 def background_color config[:background] end |
#border_color ⇒ Object
215 216 217 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 215 def border_color config[:border] end |
#card_gradient_colors ⇒ Object
202 203 204 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 202 def card_gradient_colors config[:card_gradient] end |
#card_gradient_end ⇒ Object
198 199 200 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 198 def card_gradient_end config[:card_gradient][2] end |
#card_gradient_middle ⇒ Object
194 195 196 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 194 def card_gradient_middle config[:card_gradient][1] end |
#card_gradient_start ⇒ Object
Card gradient colors
190 191 192 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 190 def card_gradient_start config[:card_gradient][0] end |
#description_gradient_colors ⇒ Object
185 186 187 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 185 def description_gradient_colors config[:description_gradient] end |
#description_gradient_end ⇒ Object
181 182 183 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 181 def description_gradient_end config[:description_gradient][2] end |
#description_gradient_middle ⇒ Object
177 178 179 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 177 def description_gradient_middle config[:description_gradient][1] end |
#description_gradient_start ⇒ Object
Description gradient colors
173 174 175 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 173 def description_gradient_start config[:description_gradient][0] end |
#frame_gradient_colors ⇒ Array<String>
Returns all frame gradient colors from outer to inner.
146 147 148 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 146 def frame_gradient_colors config[:frame_gradient] end |
#frame_gradient_end ⇒ String
Returns the frame gradient color.
141 142 143 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 141 def frame_gradient_end config[:frame_gradient][2] end |
#frame_gradient_middle ⇒ String
Returns the middle frame gradient color.
136 137 138 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 136 def frame_gradient_middle config[:frame_gradient][1] end |
#frame_gradient_start ⇒ String
Frame gradient colors (outer to inner)
131 132 133 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 131 def frame_gradient_start config[:frame_gradient][0] end |
#metallic_highlight_end ⇒ Object
232 233 234 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 232 def config[:metallic_highlight]&.[](2) end |
#metallic_highlight_middle ⇒ Object
228 229 230 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 228 def config[:metallic_highlight]&.[](1) end |
#metallic_highlight_start ⇒ Object
Metallic highlight gradient colors
224 225 226 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 224 def config[:metallic_highlight]&.first end |
#metallic_pattern_dark ⇒ Object
254 255 256 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 254 def config[:metallic_pattern]&.[](1) end |
#metallic_pattern_light ⇒ Object
Metallic pattern colors
250 251 252 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 250 def config[:metallic_pattern]&.first end |
#metallic_shadow_end ⇒ Object
245 246 247 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 245 def config[:metallic_shadow]&.[](2) end |
#metallic_shadow_middle ⇒ Object
241 242 243 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 241 def config[:metallic_shadow]&.[](1) end |
#metallic_shadow_start ⇒ Object
Metallic shadow gradient colors
237 238 239 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 237 def config[:metallic_shadow]&.first end |
#name_gradient_colors ⇒ Array<String>
Returns all name gradient colors from light to dark.
168 169 170 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 168 def name_gradient_colors config[:name_gradient] end |
#name_gradient_end ⇒ String
Returns the darkest name gradient color.
163 164 165 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 163 def name_gradient_end config[:name_gradient][2] end |
#name_gradient_middle ⇒ String
Returns the middle name gradient color.
158 159 160 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 158 def name_gradient_middle config[:name_gradient][1] end |
#name_gradient_start ⇒ String
Name gradient colors (light to dark)
153 154 155 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 153 def name_gradient_start config[:name_gradient][0] end |
#primary_color ⇒ Object
Primary colors
207 208 209 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 207 def primary_color config[:primary] end |
#text_color ⇒ Object
219 220 221 |
# File 'lib/mtg_card_maker/color_scheme.rb', line 219 def text_color config[:text] end |