Class: MtgCardMaker::ColorScheme

Inherits:
Object
  • Object
show all
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.

Examples:

scheme = MtgCardMaker::ColorScheme.new(:red)
scheme.frame_gradient_colors # => ["#F44336", "#D32F2F", "#B71C1C"]
scheme.text_color # => "#111"

Using predefined schemes

red_scheme = MtgCardMaker::ColorScheme.red
blue_scheme = MtgCardMaker::ColorScheme.blue
colorless_scheme = MtgCardMaker::ColorScheme.colorless

Since:

  • 0.1.0

Constant Summary collapse

SCHEMES =

Predefined color schemes for all MTG colors and card types

Returns:

  • (Hash)

    the predefined color scheme configurations

Since:

  • 0.1.0

{
  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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scheme_name = :colorless) ⇒ ColorScheme

Initialize a new color scheme with the given name

Parameters:

  • scheme_name (Symbol, String) (defaults to: :colorless)

    the name of the color scheme (default: :colorless)

Since:

  • 0.1.0



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

#configHash (readonly)

Returns the configuration for the current color scheme.

Returns:

  • (Hash)

    the configuration for the current color scheme

Since:

  • 0.1.0



116
117
118
# File 'lib/mtg_card_maker/color_scheme.rb', line 116

def config
  @config
end

#scheme_nameSymbol (readonly)

Returns the name of the current color scheme.

Returns:

  • (Symbol)

    the name of the current color scheme

Since:

  • 0.1.0



113
114
115
# File 'lib/mtg_card_maker/color_scheme.rb', line 113

def scheme_name
  @scheme_name
end

Class Method Details

.artifactColorScheme

Returns an artifact color scheme.

Returns:

Since:

  • 0.1.0



296
297
298
# File 'lib/mtg_card_maker/color_scheme.rb', line 296

def self.artifact
  new(:artifact)
end

.blackColorScheme

Returns a black color scheme.

Returns:

Since:

  • 0.1.0



276
277
278
# File 'lib/mtg_card_maker/color_scheme.rb', line 276

def self.black
  new(:black)
end

.blueColorScheme

Returns a blue color scheme.

Returns:

Since:

  • 0.1.0



271
272
273
# File 'lib/mtg_card_maker/color_scheme.rb', line 271

def self.blue
  new(:blue)
end

.colorlessColorScheme

Convenience methods for backward compatibility

Returns:

Since:

  • 0.1.0



261
262
263
# File 'lib/mtg_card_maker/color_scheme.rb', line 261

def self.colorless
  new(:colorless)
end

.goldColorScheme

Returns a gold color scheme.

Returns:

Since:

  • 0.1.0



291
292
293
# File 'lib/mtg_card_maker/color_scheme.rb', line 291

def self.gold
  new(:gold)
end

.greenColorScheme

Returns a green color scheme.

Returns:

Since:

  • 0.1.0



286
287
288
# File 'lib/mtg_card_maker/color_scheme.rb', line 286

def self.green
  new(:green)
end

.redColorScheme

Returns a red color scheme.

Returns:

Since:

  • 0.1.0



281
282
283
# File 'lib/mtg_card_maker/color_scheme.rb', line 281

def self.red
  new(:red)
end

.silverColorScheme

Returns a silver color scheme.

Returns:

Since:

  • 0.1.0



301
302
303
# File 'lib/mtg_card_maker/color_scheme.rb', line 301

def self.silver
  new(:silver)
end

.whiteColorScheme

Returns a white color scheme.

Returns:

Since:

  • 0.1.0



266
267
268
# File 'lib/mtg_card_maker/color_scheme.rb', line 266

def self.white
  new(:white)
end

Instance Method Details

#background_colorObject

Since:

  • 0.1.0



211
212
213
# File 'lib/mtg_card_maker/color_scheme.rb', line 211

def background_color
  config[:background]
end

#border_colorObject

Since:

  • 0.1.0



215
216
217
# File 'lib/mtg_card_maker/color_scheme.rb', line 215

def border_color
  config[:border]
end

#card_gradient_colorsObject

Since:

  • 0.1.0



202
203
204
# File 'lib/mtg_card_maker/color_scheme.rb', line 202

def card_gradient_colors
  config[:card_gradient]
end

#card_gradient_endObject

Since:

  • 0.1.0



198
199
200
# File 'lib/mtg_card_maker/color_scheme.rb', line 198

def card_gradient_end
  config[:card_gradient][2]
end

#card_gradient_middleObject

Since:

  • 0.1.0



194
195
196
# File 'lib/mtg_card_maker/color_scheme.rb', line 194

def card_gradient_middle
  config[:card_gradient][1]
end

#card_gradient_startObject

Card gradient colors

Since:

  • 0.1.0



190
191
192
# File 'lib/mtg_card_maker/color_scheme.rb', line 190

def card_gradient_start
  config[:card_gradient][0]
end

#description_gradient_colorsObject

Since:

  • 0.1.0



185
186
187
# File 'lib/mtg_card_maker/color_scheme.rb', line 185

def description_gradient_colors
  config[:description_gradient]
end

#description_gradient_endObject

Since:

  • 0.1.0



181
182
183
# File 'lib/mtg_card_maker/color_scheme.rb', line 181

def description_gradient_end
  config[:description_gradient][2]
end

#description_gradient_middleObject

Since:

  • 0.1.0



177
178
179
# File 'lib/mtg_card_maker/color_scheme.rb', line 177

def description_gradient_middle
  config[:description_gradient][1]
end

#description_gradient_startObject

Description gradient colors

Since:

  • 0.1.0



173
174
175
# File 'lib/mtg_card_maker/color_scheme.rb', line 173

def description_gradient_start
  config[:description_gradient][0]
end

#frame_gradient_colorsArray<String>

Returns all frame gradient colors from outer to inner.

Returns:

  • (Array<String>)

    all frame gradient colors from outer to inner

Since:

  • 0.1.0



146
147
148
# File 'lib/mtg_card_maker/color_scheme.rb', line 146

def frame_gradient_colors
  config[:frame_gradient]
end

#frame_gradient_endString

Returns the frame gradient color.

Returns:

  • (String)

    the frame gradient color

Since:

  • 0.1.0



141
142
143
# File 'lib/mtg_card_maker/color_scheme.rb', line 141

def frame_gradient_end
  config[:frame_gradient][2]
end

#frame_gradient_middleString

Returns the middle frame gradient color.

Returns:

  • (String)

    the middle frame gradient color

Since:

  • 0.1.0



136
137
138
# File 'lib/mtg_card_maker/color_scheme.rb', line 136

def frame_gradient_middle
  config[:frame_gradient][1]
end

#frame_gradient_startString

Frame gradient colors (outer to inner)

Returns:

  • (String)

    the border gradient color

Since:

  • 0.1.0



131
132
133
# File 'lib/mtg_card_maker/color_scheme.rb', line 131

def frame_gradient_start
  config[:frame_gradient][0]
end

#metallic_highlight_endObject

Since:

  • 0.1.0



232
233
234
# File 'lib/mtg_card_maker/color_scheme.rb', line 232

def metallic_highlight_end
  config[:metallic_highlight]&.[](2)
end

#metallic_highlight_middleObject

Since:

  • 0.1.0



228
229
230
# File 'lib/mtg_card_maker/color_scheme.rb', line 228

def metallic_highlight_middle
  config[:metallic_highlight]&.[](1)
end

#metallic_highlight_startObject

Metallic highlight gradient colors

Since:

  • 0.1.0



224
225
226
# File 'lib/mtg_card_maker/color_scheme.rb', line 224

def metallic_highlight_start
  config[:metallic_highlight]&.first
end

#metallic_pattern_darkObject

Since:

  • 0.1.0



254
255
256
# File 'lib/mtg_card_maker/color_scheme.rb', line 254

def metallic_pattern_dark
  config[:metallic_pattern]&.[](1)
end

#metallic_pattern_lightObject

Metallic pattern colors

Since:

  • 0.1.0



250
251
252
# File 'lib/mtg_card_maker/color_scheme.rb', line 250

def metallic_pattern_light
  config[:metallic_pattern]&.first
end

#metallic_shadow_endObject

Since:

  • 0.1.0



245
246
247
# File 'lib/mtg_card_maker/color_scheme.rb', line 245

def metallic_shadow_end
  config[:metallic_shadow]&.[](2)
end

#metallic_shadow_middleObject

Since:

  • 0.1.0



241
242
243
# File 'lib/mtg_card_maker/color_scheme.rb', line 241

def metallic_shadow_middle
  config[:metallic_shadow]&.[](1)
end

#metallic_shadow_startObject

Metallic shadow gradient colors

Since:

  • 0.1.0



237
238
239
# File 'lib/mtg_card_maker/color_scheme.rb', line 237

def metallic_shadow_start
  config[:metallic_shadow]&.first
end

#name_gradient_colorsArray<String>

Returns all name gradient colors from light to dark.

Returns:

  • (Array<String>)

    all name gradient colors from light to dark

Since:

  • 0.1.0



168
169
170
# File 'lib/mtg_card_maker/color_scheme.rb', line 168

def name_gradient_colors
  config[:name_gradient]
end

#name_gradient_endString

Returns the darkest name gradient color.

Returns:

  • (String)

    the darkest name gradient color

Since:

  • 0.1.0



163
164
165
# File 'lib/mtg_card_maker/color_scheme.rb', line 163

def name_gradient_end
  config[:name_gradient][2]
end

#name_gradient_middleString

Returns the middle name gradient color.

Returns:

  • (String)

    the middle name gradient color

Since:

  • 0.1.0



158
159
160
# File 'lib/mtg_card_maker/color_scheme.rb', line 158

def name_gradient_middle
  config[:name_gradient][1]
end

#name_gradient_startString

Name gradient colors (light to dark)

Returns:

  • (String)

    the lightest name gradient color

Since:

  • 0.1.0



153
154
155
# File 'lib/mtg_card_maker/color_scheme.rb', line 153

def name_gradient_start
  config[:name_gradient][0]
end

#primary_colorObject

Primary colors

Since:

  • 0.1.0



207
208
209
# File 'lib/mtg_card_maker/color_scheme.rb', line 207

def primary_color
  config[:primary]
end

#text_colorObject

Since:

  • 0.1.0



219
220
221
# File 'lib/mtg_card_maker/color_scheme.rb', line 219

def text_color
  config[:text]
end