# File lib/color/palette/monocontrast.rb, line 98
  def regenerate(background, foreground = nil)
    foreground ||= background
    background = background.to_rgb
    foreground = foreground.to_rgb

    @background = {}
    @foreground = {}

    @background[-5] = background.darken_by(10)
    @background[-4] = background.darken_by(25)
    @background[-3] = background.darken_by(50)
    @background[-2] = background.darken_by(75)
    @background[-1] = background.darken_by(85)
    @background[ 0] = background
    @background[+1] = background.lighten_by(85)
    @background[+2] = background.lighten_by(75)
    @background[+3] = background.lighten_by(50)
    @background[+4] = background.lighten_by(25)
    @background[+5] = background.lighten_by(10)

    @foreground[-5] = calculate_foreground(@background[-5], foreground)
    @foreground[-4] = calculate_foreground(@background[-4], foreground)
    @foreground[-3] = calculate_foreground(@background[-3], foreground)
    @foreground[-2] = calculate_foreground(@background[-2], foreground)
    @foreground[-1] = calculate_foreground(@background[-1], foreground)
    @foreground[ 0] = calculate_foreground(@background[ 0], foreground)
    @foreground[+1] = calculate_foreground(@background[+1], foreground)
    @foreground[+2] = calculate_foreground(@background[+2], foreground)
    @foreground[+3] = calculate_foreground(@background[+3], foreground)
    @foreground[+4] = calculate_foreground(@background[+4], foreground)
    @foreground[+5] = calculate_foreground(@background[+5], foreground)
  end