Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] 216 Colors in Window_Base

i re-wrote Window_Base to have 216 colors, do you think anyone would use it? here is the palette i used:

256-COLOR-PALETTE.png
 
A few people might find it useful. I would probably stick to the std. 16 colors for text. But if someone's using gradient bars it could come in handy.
Did you also modify Window_Message to allow the use of all 216 colors?
Did you leave the original 8 colors as is for compatability?

Grab the Script Topic Template (stickied or hit "New Topic" & cut & paste), and submit it.

Be Well
 
I have a suggestion. It may not make a huge difference, but:
Code:
  def text_color(n)

    case n

    when 0

      return Color.new(255, 255, 255, 255)

    when 1

      return Color.new(128, 128, 255, 255)

    when 2

      return Color.new(255, 128, 128, 255)

    when 3

      return Color.new(128, 255, 128, 255)

    when 4

      return Color.new(128, 255, 255, 255)

    when 5

      return Color.new(255, 128, 255, 255)

    when 6

      return Color.new(255, 255, 128, 255)

    when 7

      return Color.new(192, 192, 192, 255)

    else

      normal_color

    end

  end

That is making a new color every time a color is made. I think this might be a little better:
Code:
 

class Window_Base

  Test_Colors = {}

  Test_Colors[1] = Color.new(255, 255, 255, 255)

  Test_Colors[2] = Color.new(128, 128, 255, 255)

  # ...

  Test_Colors.default = Color.new(255, 255, 255, 255)

  def text_color(n)

    return Test_Colors[n]

  end

end

Now it no longer has to create a new color each time, at the expense of some memory. You could also make it instead to use a color cache, of created colors. Something like this:
Code:
 

class Window_Base

  @@text_color_cache = {}

  Test_Colors = {}

  Test_Colors[1] = [255, 255, 255, 255]

  Test_Colors[2] = [128, 128, 255, 255]

  # ...

  Test_Colors.default = [255, 255, 255, 255]

  def text_color(n)

    unless @@text_color_cache.has_key?(n)

      @@text_color_cache[n] = Color.new(*Test_Colors[n])

    end

    return @@text_color_cache[n]

  end

end

Now it only creates the color object if the color is called.

Just a few suggestions to throw at you. :thumb:
 
i understand the first and second part, and i love that idea i makes so much more sence, will take some time to convert tho...well lots of copy paste :) but could you please exsplain to me how the third part works better?
 
Code:
  def text_color(n)

    # If color not created yet

    unless @@text_color_cache.has_key?(n)

      # Save color to cache

      @@text_color_cache[n] = Color.new(*Test_Colors[n])

    end

    # Return saved color

    return @@text_color_cache[n]

  end

The cache starts out as an empty hash. When a color is being called, it checks the cache's keys for that color's id. If the color doesn't exist yet, it creates the color and passes the parameters defined for that color in the Test_Colors constant and then saves the color. It then returns the saved color value.
 
thanks seph, im deff gonna go your way, but do you think anyone will use it?

edit: so i have the 216 colors done, but i wanted to make it so the user could configure: normal, disabled, system, crisis, knockout. i was thinking threw a module, but im not 100% sure how to do all of that. if the module was called Plague180_Color, and i had the variable called Normal_Color = Test_Colors[1]. on the defintion of normal colorf would i just do:
Code:
def normal_color

return Color.new(Plague180_Color::Normal_Color)

im just guessing from what ive read in the past.
 
hey thanks seph! it works now. so here is my code as i have it right now, will you please let me know if you see anything wrong or somthing i should change.
Code:
#==============================================================================

# ** Window_Base

#This class was re-written by plague180 to include 216 colors.

#Special thanks to SephirothSpawn for exsplaining how to set up the cache.

#------------------------------------------------------------------------------

#  This class is for all in-game windows.

#==============================================================================

#Go to line 234 to configure. 

class Window_Base

  @@text_color_cache = {}

  Test_Colors = {}

  Test_Colors[1] = [0, 0, 0]

  Test_Colors[2] = [51, 0, 0]

  Test_Colors[3] = [102, 0, 0]

  Test_Colors[4] = [153, 0, 0]

  Test_Colors[5] = [204, 0, 0]

  Test_Colors[6] = [255, 0, 0]

  Test_Colors[7] = [0, 51, 0]

  Test_Colors[8] = [51, 51, 0]

  Test_Colors[9] = [102, 51, 0]

  Test_Colors[10] = [153, 51, 0]

  Test_Colors[11] = [204, 51, 0]

  Test_Colors[12] = [255, 51, 0]

  Test_Colors[13] = [0, 102, 0]

  Test_Colors[14] = [51, 102, 0]

  Test_Colors[15] = [102, 102, 0]

  Test_Colors[16] = [153, 102, 0]

  Test_Colors[17] = [204, 102, 0]

  Test_Colors[18] = [255, 102, 0]

  Test_Colors[19] = [0, 153, 0]

  Test_Colors[20] = [51, 153, 0]

  Test_Colors[21] = [102, 153, 0]

  Test_Colors[22] = [153, 153, 0]

  Test_Colors[23] = [204, 153, 0]

  Test_Colors[24] = [255, 153, 0]

  Test_Colors[25] = [0, 204, 0]

  Test_Colors[26] = [51, 204, 0]

  Test_Colors[27] = [102, 204, 0]

  Test_Colors[28] = [153, 204, 0]

  Test_Colors[29] = [204, 204, 0]

  Test_Colors[30] = [255, 204, 0]

  Test_Colors[31] = [0, 255, 0]

  Test_Colors[32] = [51, 255, 0]

  Test_Colors[33] = [102, 255, 0]

  Test_Colors[34] = [153, 255, 0]

  Test_Colors[35] = [204, 255, 0]

  Test_Colors[36] = [255, 255, 0]

  Test_Colors[37] = [0, 0, 51]

  Test_Colors[38] = [51, 0, 51]

  Test_Colors[39] = [102, 0, 51]

  Test_Colors[40] = [153, 0, 51]

  Test_Colors[41] = [204, 0, 51]

  Test_Colors[42] = [255, 0, 51]

  Test_Colors[43] = [0, 51, 51]

  Test_Colors[44] = [51, 51, 51]

  Test_Colors[45] = [102, 51, 51]

  Test_Colors[46] = [153, 51, 51]

  Test_Colors[47] = [204, 51, 51]

  Test_Colors[48] = [255, 51, 51]

  Test_Colors[49] = [0, 102, 51]

  Test_Colors[50] = [51, 102, 51]

  Test_Colors[51] = [102, 102, 51]

  Test_Colors[52] = [153, 102, 51]

  Test_Colors[53] = [204, 102, 51]

  Test_Colors[54] = [255, 102, 51]

  Test_Colors[55] = [0, 153, 51]

  Test_Colors[56] = [51, 153, 51]

  Test_Colors[57] = [102, 153, 51]

  Test_Colors[58] = [153, 153, 51]

  Test_Colors[59] = [204, 153, 51]

  Test_Colors[60] = [255, 153, 51]

  Test_Colors[61] = [0, 204, 51]

  Test_Colors[62] = [51, 204, 51]

  Test_Colors[63] = [102, 204, 51]

  Test_Colors[64] = [153, 204, 51]

  Test_Colors[65] = [204, 204, 51]

  Test_Colors[66] = [255, 204, 51]

  Test_Colors[67] = [0, 255, 51]

  Test_Colors[68] = [51, 255, 51]

  Test_Colors[69] = [102, 255, 51]

  Test_Colors[70] = [153, 255, 51]

  Test_Colors[71] = [204, 255, 51]

  Test_Colors[72] = [255, 255, 51]  

  Test_Colors[73] = [0, 0, 102]

  Test_Colors[74] = [51, 0, 102]

  Test_Colors[75] = [102, 0, 102]

  Test_Colors[76] = [153, 0, 102]

  Test_Colors[77] = [204, 0, 102]

  Test_Colors[78] = [255, 0, 102]

  Test_Colors[79] = [0, 51, 102]

  Test_Colors[80] = [51, 51, 102]

  Test_Colors[81] = [102, 51, 102]

  Test_Colors[82] = [153, 51, 102]

  Test_Colors[83] = [204, 51, 102]

  Test_Colors[84] = [255, 51, 102]

  Test_Colors[85] = [0, 102, 102]

  Test_Colors[86] = [51, 102, 102]

  Test_Colors[87] = [102, 102, 102]

  Test_Colors[88] = [153, 102, 102]

  Test_Colors[89] = [204, 102, 102]

  Test_Colors[90] = [255, 102, 102]

  Test_Colors[91] = [0, 153, 102]

  Test_Colors[92] = [51, 153, 102]

  Test_Colors[93] = [102, 153, 102]

  Test_Colors[94] = [153, 153, 102]

  Test_Colors[95] = [204, 153, 102]

  Test_Colors[96] = [255, 153, 102]

  Test_Colors[97] = [0, 204, 102]

  Test_Colors[98] = [51, 204, 102]

  Test_Colors[99] = [102, 204, 102]

  Test_Colors[100] = [153, 204, 102]

  Test_Colors[101] = [204, 204, 102]

  Test_Colors[102] = [255, 204, 102]

  Test_Colors[103] = [0, 255, 102]

  Test_Colors[104] = [51, 255, 102]

  Test_Colors[105] = [102, 255, 102]

  Test_Colors[106] = [153, 255, 102]

  Test_Colors[107] = [204, 255, 102]

  Test_Colors[108] = [255, 255, 102]

  Test_Colors[109] = [0, 0, 153]

  Test_Colors[110] = [51, 0, 153]

  Test_Colors[111] = [102, 0, 153]

  Test_Colors[112] = [153, 0, 153]

  Test_Colors[113] = [204, 0, 153]

  Test_Colors[114] = [255, 0, 153]

  Test_Colors[115] = [0, 51, 153]

  Test_Colors[116] = [51, 51, 153]

  Test_Colors[117] = [102, 51, 153]

  Test_Colors[118] = [153, 51, 153]

  Test_Colors[119] = [204, 51, 153]

  Test_Colors[120] = [255, 51, 153]

  Test_Colors[121] = [0, 102, 153]

  Test_Colors[122] = [51, 102, 153]

  Test_Colors[123] = [102, 102, 153]

  Test_Colors[124] = [153, 102, 153]

  Test_Colors[125] = [204, 102, 153]

  Test_Colors[126] = [255, 102, 153]

  Test_Colors[127] = [0, 153, 153]

  Test_Colors[128] = [51, 153, 153]

  Test_Colors[129] = [102, 153, 153]

  Test_Colors[130] = [153, 153, 153]

  Test_Colors[131] = [204, 153, 153]

  Test_Colors[132] = [255, 153, 153]

  Test_Colors[133] = [0, 204, 153]

  Test_Colors[134] = [51, 204, 153]

  Test_Colors[135] = [102, 204, 153]

  Test_Colors[136] = [153, 204, 153]

  Test_Colors[137] = [204, 204, 153]

  Test_Colors[138] = [255, 204, 153]

  Test_Colors[139] = [0, 255, 153]

  Test_Colors[140] = [51, 255, 153]

  Test_Colors[141] = [102, 255, 135]

  Test_Colors[142] = [153, 255, 153]

  Test_Colors[143] = [204, 255, 153]

  Test_Colors[144] = [255, 255, 153]

  Test_Colors[145] = [0, 0, 204]

  Test_Colors[146] = [51, 0, 204]

  Test_Colors[147] = [102, 0, 204]

  Test_Colors[148] = [153, 0, 204]

  Test_Colors[149] = [204, 0, 204]

  Test_Colors[150] = [255, 0, 204]

  Test_Colors[151] = [0, 51, 204]

  Test_Colors[152] = [51, 51, 204]

  Test_Colors[153] = [102, 51, 204]

  Test_Colors[154] = [153, 51, 204]

  Test_Colors[155] = [204, 51, 204]

  Test_Colors[156] = [255, 51, 204]

  Test_Colors[157] = [0, 102, 204]

  Test_Colors[158] = [51, 102, 204]

  Test_Colors[159] = [102, 102, 204]

  Test_Colors[160] = [153, 102, 204]

  Test_Colors[161] = [204, 102, 204]

  Test_Colors[162] = [255, 102, 204]

  Test_Colors[163] = [0, 153, 204]

  Test_Colors[164] = [51, 153, 204]

  Test_Colors[165] = [102, 153, 204]

  Test_Colors[166] = [153, 153, 204]

  Test_Colors[167] = [204, 153, 204]

  Test_Colors[168] = [255, 153, 204]

  Test_Colors[169] = [0, 204, 204]

  Test_Colors[170] = [51, 204, 204]

  Test_Colors[171] = [102, 204, 204]

  Test_Colors[172] = [153, 204, 204]

  Test_Colors[173] = [204, 204, 204]

  Test_Colors[174] = [255, 204, 204]

  Test_Colors[175] = [0, 255, 204]

  Test_Colors[176] = [51, 255, 204]

  Test_Colors[177] = [102, 255, 204]

  Test_Colors[178] = [153, 255, 204]

  Test_Colors[179] = [204, 255, 204]

  Test_Colors[180] = [255, 255, 204]  

  Test_Colors[181] = [0, 0, 255]

  Test_Colors[182] = [51, 0, 255]

  Test_Colors[183] = [102, 0, 255]

  Test_Colors[184] = [153, 0, 255]

  Test_Colors[185] = [204, 0, 255]

  Test_Colors[186] = [255, 0, 255]

  Test_Colors[187] = [0, 51, 255]

  Test_Colors[188] = [51, 51, 255]

  Test_Colors[189] = [102, 51, 255]

  Test_Colors[190] = [153, 51, 255]

  Test_Colors[191] = [204, 51, 255]

  Test_Colors[192] = [255, 51, 255]

  Test_Colors[193] = [0, 102, 255]

  Test_Colors[194] = [51, 102, 255]

  Test_Colors[195] = [102, 102, 255]

  Test_Colors[196] = [153, 102, 255]

  Test_Colors[197] = [204, 102, 255]

  Test_Colors[198] = [255, 102, 255]

  Test_Colors[199] = [0, 153, 255]

  Test_Colors[200] = [51, 153, 255]

  Test_Colors[201] = [102, 153, 255]

  Test_Colors[202] = [153, 153, 255]

  Test_Colors[203] = [204, 153, 255]

  Test_Colors[204] = [255, 153, 255]

  Test_Colors[205] = [0, 204, 255]

  Test_Colors[206] = [51, 204, 25]

  Test_Colors[207] = [102, 204, 255]

  Test_Colors[208] = [153, 204, 255]

  Test_Colors[209] = [204, 204, 255]

  Test_Colors[210] = [255, 204, 255]

  Test_Colors[211] = [0, 255, 255]

  Test_Colors[212] = [51, 255, 255]

  Test_Colors[213] = [102, 255, 255]

  Test_Colors[214] = [153, 255, 255]

  Test_Colors[215] = [204, 255, 255]

  Test_Colors[216] = [255, 255, 255]  

  Test_Colors.default = [255, 255, 255, 255]

#------------------------------------------------------------------------------

#To configure you can either change the numerical values or point it towards

#one of the Test_Colors e.g:

#Normanl_Color = Test_Colors[210]

module Plague180_Color

  Normal_Color = [255, 255, 255, 255] 

  Disabled_Color = [255, 255, 255, 128]

  System_Color = [192, 224, 255, 255]

  Crisis_Color = [255, 255, 64, 255]

  Knockout_Color = [255, 64, 0, 255]

end 

 

#-----------------------------------------------------------------------------

  #--------------------------------------------------------------------------

  # * Get Text Color

  #     n : text color number (0-7)

  #--------------------------------------------------------------------------

   def text_color(n)

    # If color not created yet

    unless @@text_color_cache.has_key?(n)

      # Save color to cache

      @@text_color_cache[n] = Color.new(*Test_Colors[n])

    end

    # Return saved color

    return @@text_color_cache[n]

  end

  #--------------------------------------------------------------------------

  # * Get Normal Text Color

  #--------------------------------------------------------------------------

  def normal_color

    return Color.new(*Plague180_Color::Normal_Color)

  end

  #--------------------------------------------------------------------------

  # * Get Disabled Text Color

  #--------------------------------------------------------------------------

  def disabled_color

    return Color.new(*Plague180_Color::Disabled_Color)

  end

  #--------------------------------------------------------------------------

  # * Get System Text Color

  #--------------------------------------------------------------------------

  def system_color

    return Color.new(*Plague180_Color::System_Color)

  end

  #--------------------------------------------------------------------------

  # * Get Crisis Text Color

  #--------------------------------------------------------------------------

  def crisis_color

    return Color.new(*Plague180_Color::Crisis_Color)

  end

  #--------------------------------------------------------------------------

  # * Get Knockout Text Color

  #--------------------------------------------------------------------------

  def knockout_color

    return Color.new(*Plague180_Color::Kockout_Color)

  end 

end

 
 
I suggest putting your Text_Colors constant in your module as well. Also your module is within your Window_Base class. I don't suggest doing this (doesn't hurt, but any script who wants access to the constant (if it ever comes up) has to use Window_Base::Plague180_Color. You can also cache the special colors as well. Just instead of n, use @@text_color_cache['normal'] and such. Finally I suggest rather than making separate constants for 'normal_color', 'crisis_color', etc., adding Text_Colors['normal'] and such. More on why below.

You could also utilize the fact that you are using a module, and make reading the color from a method within that module and moving the cache into your module. Like so:
Code:
module Plague180_Color

  # Color definition goes here

   @cache = {}

   def self.get_color(id)

      unless @cache.has_key?(id)

        @cache[id] = Color.new(*Text_Colors[id])

      end

      return @cache[id]

    end

  end

end

 

class Window_Base

  def text_color(n)

    return Plague180_Color.get_color(n)

  end

  def normal_color

    return Plague180_Color.get_color('normal')

  end

  # ...

end

:thumb:
 
ok, this is what i got so far, but i know im missing something...
Code:
#==============================================================================

# ** Window_Base

#This class was re-written by plague180 to include 216 colors.

#Special thanks to SephirothSpawn for exsplaining how to set up the cache.

#------------------------------------------------------------------------------

#  This class is for all in-game windows.

#==============================================================================

module Plague180_Color

#To configure you can either change the numerical values or point it towards

#one of the Test_Colors e.g:

#Normanl_Color = Test_Colors[210]

  Normal_Color = [255, 255, 255, 255] 

  Disabled_Color = [255, 255, 255, 128]

  System_Color = [192, 224, 255, 255]

  Crisis_Color = [255, 255, 64, 255]

  Knockout_Color = [255, 64, 0, 255]

#------------------------------------------------------------------------------  

  @@text_color_cache = {}

  Test_Colors = {}

  Test_Colors['normal'] = Normal_Color

  Test_Colors['disabled'] = Disabled_Color

  Test_Colors['system'] = System_Color

  Test_Colors['crisis'] = Crisis_Color

  Test_Colors['knockout'] = Knockout_Color

  Test_Colors[1] = [0, 0, 0]

  Test_Colors[2] = [51, 0, 0]

  Test_Colors[3] = [102, 0, 0]

  Test_Colors[4] = [153, 0, 0]

  Test_Colors[5] = [204, 0, 0]

  Test_Colors[6] = [255, 0, 0]

  Test_Colors[7] = [0, 51, 0]

  Test_Colors[8] = [51, 51, 0]

  Test_Colors[9] = [102, 51, 0]

  Test_Colors[10] = [153, 51, 0]

  Test_Colors[11] = [204, 51, 0]

  Test_Colors[12] = [255, 51, 0]

  Test_Colors[13] = [0, 102, 0]

  Test_Colors[14] = [51, 102, 0]

  Test_Colors[15] = [102, 102, 0]

  Test_Colors[16] = [153, 102, 0]

  Test_Colors[17] = [204, 102, 0]

  Test_Colors[18] = [255, 102, 0]

  Test_Colors[19] = [0, 153, 0]

  Test_Colors[20] = [51, 153, 0]

  Test_Colors[21] = [102, 153, 0]

  Test_Colors[22] = [153, 153, 0]

  Test_Colors[23] = [204, 153, 0]

  Test_Colors[24] = [255, 153, 0]

  Test_Colors[25] = [0, 204, 0]

  Test_Colors[26] = [51, 204, 0]

  Test_Colors[27] = [102, 204, 0]

  Test_Colors[28] = [153, 204, 0]

  Test_Colors[29] = [204, 204, 0]

  Test_Colors[30] = [255, 204, 0]

  Test_Colors[31] = [0, 255, 0]

  Test_Colors[32] = [51, 255, 0]

  Test_Colors[33] = [102, 255, 0]

  Test_Colors[34] = [153, 255, 0]

  Test_Colors[35] = [204, 255, 0]

  Test_Colors[36] = [255, 255, 0]

  Test_Colors[37] = [0, 0, 51]

  Test_Colors[38] = [51, 0, 51]

  Test_Colors[39] = [102, 0, 51]

  Test_Colors[40] = [153, 0, 51]

  Test_Colors[41] = [204, 0, 51]

  Test_Colors[42] = [255, 0, 51]

  Test_Colors[43] = [0, 51, 51]

  Test_Colors[44] = [51, 51, 51]

  Test_Colors[45] = [102, 51, 51]

  Test_Colors[46] = [153, 51, 51]

  Test_Colors[47] = [204, 51, 51]

  Test_Colors[48] = [255, 51, 51]

  Test_Colors[49] = [0, 102, 51]

  Test_Colors[50] = [51, 102, 51]

  Test_Colors[51] = [102, 102, 51]

  Test_Colors[52] = [153, 102, 51]

  Test_Colors[53] = [204, 102, 51]

  Test_Colors[54] = [255, 102, 51]

  Test_Colors[55] = [0, 153, 51]

  Test_Colors[56] = [51, 153, 51]

  Test_Colors[57] = [102, 153, 51]

  Test_Colors[58] = [153, 153, 51]

  Test_Colors[59] = [204, 153, 51]

  Test_Colors[60] = [255, 153, 51]

  Test_Colors[61] = [0, 204, 51]

  Test_Colors[62] = [51, 204, 51]

  Test_Colors[63] = [102, 204, 51]

  Test_Colors[64] = [153, 204, 51]

  Test_Colors[65] = [204, 204, 51]

  Test_Colors[66] = [255, 204, 51]

  Test_Colors[67] = [0, 255, 51]

  Test_Colors[68] = [51, 255, 51]

  Test_Colors[69] = [102, 255, 51]

  Test_Colors[70] = [153, 255, 51]

  Test_Colors[71] = [204, 255, 51]

  Test_Colors[72] = [255, 255, 51]  

  Test_Colors[73] = [0, 0, 102]

  Test_Colors[74] = [51, 0, 102]

  Test_Colors[75] = [102, 0, 102]

  Test_Colors[76] = [153, 0, 102]

  Test_Colors[77] = [204, 0, 102]

  Test_Colors[78] = [255, 0, 102]

  Test_Colors[79] = [0, 51, 102]

  Test_Colors[80] = [51, 51, 102]

  Test_Colors[81] = [102, 51, 102]

  Test_Colors[82] = [153, 51, 102]

  Test_Colors[83] = [204, 51, 102]

  Test_Colors[84] = [255, 51, 102]

  Test_Colors[85] = [0, 102, 102]

  Test_Colors[86] = [51, 102, 102]

  Test_Colors[87] = [102, 102, 102]

  Test_Colors[88] = [153, 102, 102]

  Test_Colors[89] = [204, 102, 102]

  Test_Colors[90] = [255, 102, 102]

  Test_Colors[91] = [0, 153, 102]

  Test_Colors[92] = [51, 153, 102]

  Test_Colors[93] = [102, 153, 102]

  Test_Colors[94] = [153, 153, 102]

  Test_Colors[95] = [204, 153, 102]

  Test_Colors[96] = [255, 153, 102]

  Test_Colors[97] = [0, 204, 102]

  Test_Colors[98] = [51, 204, 102]

  Test_Colors[99] = [102, 204, 102]

  Test_Colors[100] = [153, 204, 102]

  Test_Colors[101] = [204, 204, 102]

  Test_Colors[102] = [255, 204, 102]

  Test_Colors[103] = [0, 255, 102]

  Test_Colors[104] = [51, 255, 102]

  Test_Colors[105] = [102, 255, 102]

  Test_Colors[106] = [153, 255, 102]

  Test_Colors[107] = [204, 255, 102]

  Test_Colors[108] = [255, 255, 102]

  Test_Colors[109] = [0, 0, 153]

  Test_Colors[110] = [51, 0, 153]

  Test_Colors[111] = [102, 0, 153]

  Test_Colors[112] = [153, 0, 153]

  Test_Colors[113] = [204, 0, 153]

  Test_Colors[114] = [255, 0, 153]

  Test_Colors[115] = [0, 51, 153]

  Test_Colors[116] = [51, 51, 153]

  Test_Colors[117] = [102, 51, 153]

  Test_Colors[118] = [153, 51, 153]

  Test_Colors[119] = [204, 51, 153]

  Test_Colors[120] = [255, 51, 153]

  Test_Colors[121] = [0, 102, 153]

  Test_Colors[122] = [51, 102, 153]

  Test_Colors[123] = [102, 102, 153]

  Test_Colors[124] = [153, 102, 153]

  Test_Colors[125] = [204, 102, 153]

  Test_Colors[126] = [255, 102, 153]

  Test_Colors[127] = [0, 153, 153]

  Test_Colors[128] = [51, 153, 153]

  Test_Colors[129] = [102, 153, 153]

  Test_Colors[130] = [153, 153, 153]

  Test_Colors[131] = [204, 153, 153]

  Test_Colors[132] = [255, 153, 153]

  Test_Colors[133] = [0, 204, 153]

  Test_Colors[134] = [51, 204, 153]

  Test_Colors[135] = [102, 204, 153]

  Test_Colors[136] = [153, 204, 153]

  Test_Colors[137] = [204, 204, 153]

  Test_Colors[138] = [255, 204, 153]

  Test_Colors[139] = [0, 255, 153]

  Test_Colors[140] = [51, 255, 153]

  Test_Colors[141] = [102, 255, 135]

  Test_Colors[142] = [153, 255, 153]

  Test_Colors[143] = [204, 255, 153]

  Test_Colors[144] = [255, 255, 153]

  Test_Colors[145] = [0, 0, 204]

  Test_Colors[146] = [51, 0, 204]

  Test_Colors[147] = [102, 0, 204]

  Test_Colors[148] = [153, 0, 204]

  Test_Colors[149] = [204, 0, 204]

  Test_Colors[150] = [255, 0, 204]

  Test_Colors[151] = [0, 51, 204]

  Test_Colors[152] = [51, 51, 204]

  Test_Colors[153] = [102, 51, 204]

  Test_Colors[154] = [153, 51, 204]

  Test_Colors[155] = [204, 51, 204]

  Test_Colors[156] = [255, 51, 204]

  Test_Colors[157] = [0, 102, 204]

  Test_Colors[158] = [51, 102, 204]

  Test_Colors[159] = [102, 102, 204]

  Test_Colors[160] = [153, 102, 204]

  Test_Colors[161] = [204, 102, 204]

  Test_Colors[162] = [255, 102, 204]

  Test_Colors[163] = [0, 153, 204]

  Test_Colors[164] = [51, 153, 204]

  Test_Colors[165] = [102, 153, 204]

  Test_Colors[166] = [153, 153, 204]

  Test_Colors[167] = [204, 153, 204]

  Test_Colors[168] = [255, 153, 204]

  Test_Colors[169] = [0, 204, 204]

  Test_Colors[170] = [51, 204, 204]

  Test_Colors[171] = [102, 204, 204]

  Test_Colors[172] = [153, 204, 204]

  Test_Colors[173] = [204, 204, 204]

  Test_Colors[174] = [255, 204, 204]

  Test_Colors[175] = [0, 255, 204]

  Test_Colors[176] = [51, 255, 204]

  Test_Colors[177] = [102, 255, 204]

  Test_Colors[178] = [153, 255, 204]

  Test_Colors[179] = [204, 255, 204]

  Test_Colors[180] = [255, 255, 204]  

  Test_Colors[181] = [0, 0, 255]

  Test_Colors[182] = [51, 0, 255]

  Test_Colors[183] = [102, 0, 255]

  Test_Colors[184] = [153, 0, 255]

  Test_Colors[185] = [204, 0, 255]

  Test_Colors[186] = [255, 0, 255]

  Test_Colors[187] = [0, 51, 255]

  Test_Colors[188] = [51, 51, 255]

  Test_Colors[189] = [102, 51, 255]

  Test_Colors[190] = [153, 51, 255]

  Test_Colors[191] = [204, 51, 255]

  Test_Colors[192] = [255, 51, 255]

  Test_Colors[193] = [0, 102, 255]

  Test_Colors[194] = [51, 102, 255]

  Test_Colors[195] = [102, 102, 255]

  Test_Colors[196] = [153, 102, 255]

  Test_Colors[197] = [204, 102, 255]

  Test_Colors[198] = [255, 102, 255]

  Test_Colors[199] = [0, 153, 255]

  Test_Colors[200] = [51, 153, 255]

  Test_Colors[201] = [102, 153, 255]

  Test_Colors[202] = [153, 153, 255]

  Test_Colors[203] = [204, 153, 255]

  Test_Colors[204] = [255, 153, 255]

  Test_Colors[205] = [0, 204, 255]

  Test_Colors[206] = [51, 204, 25]

  Test_Colors[207] = [102, 204, 255]

  Test_Colors[208] = [153, 204, 255]

  Test_Colors[209] = [204, 204, 255]

  Test_Colors[210] = [255, 204, 255]

  Test_Colors[211] = [0, 255, 255]

  Test_Colors[212] = [51, 255, 255]

  Test_Colors[213] = [102, 255, 255]

  Test_Colors[214] = [153, 255, 255]

  Test_Colors[215] = [204, 255, 255]

  Test_Colors[216] = [255, 255, 255]  

  Test_Colors.default = [255, 255, 255, 255]

  @cache = {}

   def self.get_color(id)

      unless @cache.has_key?(id)

        @cache[id] = Color.new(*Text_Colors[id])

      end

      return @cache[id]

    end

end 

class Window_Base

#-----------------------------------------------------------------------------

  #--------------------------------------------------------------------------

  # * Get Text Color

  #--------------------------------------------------------------------------

   def text_color(n)

     return Plague180_Color.get_color(n)

  end

  #--------------------------------------------------------------------------

  # * Get Normal Text Color

  #--------------------------------------------------------------------------

  def normal_color

    return Plague180_Color.get_color('normal')

  end

  #--------------------------------------------------------------------------

  # * Get Disabled Text Color

  #--------------------------------------------------------------------------

  def disabled_color

    return Plague180_Color.get_color('disabled')

  end

  #--------------------------------------------------------------------------

  # * Get System Text Color

  #--------------------------------------------------------------------------

  def system_color

    return Plague180_Color.get_color('system')

  end

  #--------------------------------------------------------------------------

  # * Get Crisis Text Color

  #--------------------------------------------------------------------------

  def crisis_color

    return Plague180_Color.get_color('crisis')

  end

  #--------------------------------------------------------------------------

  # * Get Knockout Text Color

  #--------------------------------------------------------------------------

  def knockout_color

    return Plague180_Color.get_color('knockout')

  end 

end

 
 
Code:
  Normal_Color = [255, 255, 255, 255]

  Disabled_Color = [255, 255, 255, 128]

  System_Color = [192, 224, 255, 255]

  Crisis_Color = [255, 255, 64, 255]

  Knockout_Color = [255, 64, 0, 255]

#------------------------------------------------------------------------------  

  @@text_color_cache = {}

  Test_Colors = {}

  Test_Colors['normal'] = Normal_Color

  Test_Colors['disabled'] = Disabled_Color

  Test_Colors['system'] = System_Color

  Test_Colors['crisis'] = Crisis_Color

  Test_Colors['knockout'] = Knockout_Color

You can remove the Normal_Color/etc constants and just add that setup where you set the values in the Test_Colors constant. You can also remove the @@text_color_cache as we no longer use this.

Code:
  Test_Colors = {}

  Test_Colors['normal'] = [255, 255, 255]

  Test_Colors['disabled'] = [255, 255, 255, 128]

  Test_Colors['system'] = [192, 224, 255]

  Test_Colors['crisis'] = [255, 255, 64]

  Test_Colors['knockout'] = [255, 64, 0]

Any color with 255 as the 4th value, the 255 may be omitted because it defaults to 255.
 
edit:eek:k, i found the problem here is the new code:
Code:
#==============================================================================

# ** Window_Base

#This class was re-written by plague180 to include 216 colors.

#Special thanks to SephirothSpawn for exsplaining how to set up the cache.

#------------------------------------------------------------------------------

#  This class is for all in-game windows.

#==============================================================================

module Plague180_Color

#To configure you can either change the numerical values or point it towards

#one of the Test_Colors e.g:

#Normanl_Color = Test_Colors[210]

 

  Test_Colors = {}

  Test_Colors['normal'] = [255, 255, 255, 255] 

  Test_Colors['disabled'] = [255, 255, 255, 128]

  Test_Colors['system'] = [192, 224, 255, 255]

  Test_Colors['crisis'] = [255, 255, 64, 255]

  Test_Colors['knockout'] = [255, 64, 0, 255]

#------------------------------------------------------------------------------   

  Test_Colors[1] = [0, 0, 0]

  Test_Colors[2] = [51, 0, 0]

  Test_Colors[3] = [102, 0, 0]

  Test_Colors[4] = [153, 0, 0]

  Test_Colors[5] = [204, 0, 0]

  Test_Colors[6] = [255, 0, 0]

  Test_Colors[7] = [0, 51, 0]

  Test_Colors[8] = [51, 51, 0]

  Test_Colors[9] = [102, 51, 0]

  Test_Colors[10] = [153, 51, 0]

  Test_Colors[11] = [204, 51, 0]

  Test_Colors[12] = [255, 51, 0]

  Test_Colors[13] = [0, 102, 0]

  Test_Colors[14] = [51, 102, 0]

  Test_Colors[15] = [102, 102, 0]

  Test_Colors[16] = [153, 102, 0]

  Test_Colors[17] = [204, 102, 0]

  Test_Colors[18] = [255, 102, 0]

  Test_Colors[19] = [0, 153, 0]

  Test_Colors[20] = [51, 153, 0]

  Test_Colors[21] = [102, 153, 0]

  Test_Colors[22] = [153, 153, 0]

  Test_Colors[23] = [204, 153, 0]

  Test_Colors[24] = [255, 153, 0]

  Test_Colors[25] = [0, 204, 0]

  Test_Colors[26] = [51, 204, 0]

  Test_Colors[27] = [102, 204, 0]

  Test_Colors[28] = [153, 204, 0]

  Test_Colors[29] = [204, 204, 0]

  Test_Colors[30] = [255, 204, 0]

  Test_Colors[31] = [0, 255, 0]

  Test_Colors[32] = [51, 255, 0]

  Test_Colors[33] = [102, 255, 0]

  Test_Colors[34] = [153, 255, 0]

  Test_Colors[35] = [204, 255, 0]

  Test_Colors[36] = [255, 255, 0]

  Test_Colors[37] = [0, 0, 51]

  Test_Colors[38] = [51, 0, 51]

  Test_Colors[39] = [102, 0, 51]

  Test_Colors[40] = [153, 0, 51]

  Test_Colors[41] = [204, 0, 51]

  Test_Colors[42] = [255, 0, 51]

  Test_Colors[43] = [0, 51, 51]

  Test_Colors[44] = [51, 51, 51]

  Test_Colors[45] = [102, 51, 51]

  Test_Colors[46] = [153, 51, 51]

  Test_Colors[47] = [204, 51, 51]

  Test_Colors[48] = [255, 51, 51]

  Test_Colors[49] = [0, 102, 51]

  Test_Colors[50] = [51, 102, 51]

  Test_Colors[51] = [102, 102, 51]

  Test_Colors[52] = [153, 102, 51]

  Test_Colors[53] = [204, 102, 51]

  Test_Colors[54] = [255, 102, 51]

  Test_Colors[55] = [0, 153, 51]

  Test_Colors[56] = [51, 153, 51]

  Test_Colors[57] = [102, 153, 51]

  Test_Colors[58] = [153, 153, 51]

  Test_Colors[59] = [204, 153, 51]

  Test_Colors[60] = [255, 153, 51]

  Test_Colors[61] = [0, 204, 51]

  Test_Colors[62] = [51, 204, 51]

  Test_Colors[63] = [102, 204, 51]

  Test_Colors[64] = [153, 204, 51]

  Test_Colors[65] = [204, 204, 51]

  Test_Colors[66] = [255, 204, 51]

  Test_Colors[67] = [0, 255, 51]

  Test_Colors[68] = [51, 255, 51]

  Test_Colors[69] = [102, 255, 51]

  Test_Colors[70] = [153, 255, 51]

  Test_Colors[71] = [204, 255, 51]

  Test_Colors[72] = [255, 255, 51]  

  Test_Colors[73] = [0, 0, 102]

  Test_Colors[74] = [51, 0, 102]

  Test_Colors[75] = [102, 0, 102]

  Test_Colors[76] = [153, 0, 102]

  Test_Colors[77] = [204, 0, 102]

  Test_Colors[78] = [255, 0, 102]

  Test_Colors[79] = [0, 51, 102]

  Test_Colors[80] = [51, 51, 102]

  Test_Colors[81] = [102, 51, 102]

  Test_Colors[82] = [153, 51, 102]

  Test_Colors[83] = [204, 51, 102]

  Test_Colors[84] = [255, 51, 102]

  Test_Colors[85] = [0, 102, 102]

  Test_Colors[86] = [51, 102, 102]

  Test_Colors[87] = [102, 102, 102]

  Test_Colors[88] = [153, 102, 102]

  Test_Colors[89] = [204, 102, 102]

  Test_Colors[90] = [255, 102, 102]

  Test_Colors[91] = [0, 153, 102]

  Test_Colors[92] = [51, 153, 102]

  Test_Colors[93] = [102, 153, 102]

  Test_Colors[94] = [153, 153, 102]

  Test_Colors[95] = [204, 153, 102]

  Test_Colors[96] = [255, 153, 102]

  Test_Colors[97] = [0, 204, 102]

  Test_Colors[98] = [51, 204, 102]

  Test_Colors[99] = [102, 204, 102]

  Test_Colors[100] = [153, 204, 102]

  Test_Colors[101] = [204, 204, 102]

  Test_Colors[102] = [255, 204, 102]

  Test_Colors[103] = [0, 255, 102]

  Test_Colors[104] = [51, 255, 102]

  Test_Colors[105] = [102, 255, 102]

  Test_Colors[106] = [153, 255, 102]

  Test_Colors[107] = [204, 255, 102]

  Test_Colors[108] = [255, 255, 102]

  Test_Colors[109] = [0, 0, 153]

  Test_Colors[110] = [51, 0, 153]

  Test_Colors[111] = [102, 0, 153]

  Test_Colors[112] = [153, 0, 153]

  Test_Colors[113] = [204, 0, 153]

  Test_Colors[114] = [255, 0, 153]

  Test_Colors[115] = [0, 51, 153]

  Test_Colors[116] = [51, 51, 153]

  Test_Colors[117] = [102, 51, 153]

  Test_Colors[118] = [153, 51, 153]

  Test_Colors[119] = [204, 51, 153]

  Test_Colors[120] = [255, 51, 153]

  Test_Colors[121] = [0, 102, 153]

  Test_Colors[122] = [51, 102, 153]

  Test_Colors[123] = [102, 102, 153]

  Test_Colors[124] = [153, 102, 153]

  Test_Colors[125] = [204, 102, 153]

  Test_Colors[126] = [255, 102, 153]

  Test_Colors[127] = [0, 153, 153]

  Test_Colors[128] = [51, 153, 153]

  Test_Colors[129] = [102, 153, 153]

  Test_Colors[130] = [153, 153, 153]

  Test_Colors[131] = [204, 153, 153]

  Test_Colors[132] = [255, 153, 153]

  Test_Colors[133] = [0, 204, 153]

  Test_Colors[134] = [51, 204, 153]

  Test_Colors[135] = [102, 204, 153]

  Test_Colors[136] = [153, 204, 153]

  Test_Colors[137] = [204, 204, 153]

  Test_Colors[138] = [255, 204, 153]

  Test_Colors[139] = [0, 255, 153]

  Test_Colors[140] = [51, 255, 153]

  Test_Colors[141] = [102, 255, 135]

  Test_Colors[142] = [153, 255, 153]

  Test_Colors[143] = [204, 255, 153]

  Test_Colors[144] = [255, 255, 153]

  Test_Colors[145] = [0, 0, 204]

  Test_Colors[146] = [51, 0, 204]

  Test_Colors[147] = [102, 0, 204]

  Test_Colors[148] = [153, 0, 204]

  Test_Colors[149] = [204, 0, 204]

  Test_Colors[150] = [255, 0, 204]

  Test_Colors[151] = [0, 51, 204]

  Test_Colors[152] = [51, 51, 204]

  Test_Colors[153] = [102, 51, 204]

  Test_Colors[154] = [153, 51, 204]

  Test_Colors[155] = [204, 51, 204]

  Test_Colors[156] = [255, 51, 204]

  Test_Colors[157] = [0, 102, 204]

  Test_Colors[158] = [51, 102, 204]

  Test_Colors[159] = [102, 102, 204]

  Test_Colors[160] = [153, 102, 204]

  Test_Colors[161] = [204, 102, 204]

  Test_Colors[162] = [255, 102, 204]

  Test_Colors[163] = [0, 153, 204]

  Test_Colors[164] = [51, 153, 204]

  Test_Colors[165] = [102, 153, 204]

  Test_Colors[166] = [153, 153, 204]

  Test_Colors[167] = [204, 153, 204]

  Test_Colors[168] = [255, 153, 204]

  Test_Colors[169] = [0, 204, 204]

  Test_Colors[170] = [51, 204, 204]

  Test_Colors[171] = [102, 204, 204]

  Test_Colors[172] = [153, 204, 204]

  Test_Colors[173] = [204, 204, 204]

  Test_Colors[174] = [255, 204, 204]

  Test_Colors[175] = [0, 255, 204]

  Test_Colors[176] = [51, 255, 204]

  Test_Colors[177] = [102, 255, 204]

  Test_Colors[178] = [153, 255, 204]

  Test_Colors[179] = [204, 255, 204]

  Test_Colors[180] = [255, 255, 204]  

  Test_Colors[181] = [0, 0, 255]

  Test_Colors[182] = [51, 0, 255]

  Test_Colors[183] = [102, 0, 255]

  Test_Colors[184] = [153, 0, 255]

  Test_Colors[185] = [204, 0, 255]

  Test_Colors[186] = [255, 0, 255]

  Test_Colors[187] = [0, 51, 255]

  Test_Colors[188] = [51, 51, 255]

  Test_Colors[189] = [102, 51, 255]

  Test_Colors[190] = [153, 51, 255]

  Test_Colors[191] = [204, 51, 255]

  Test_Colors[192] = [255, 51, 255]

  Test_Colors[193] = [0, 102, 255]

  Test_Colors[194] = [51, 102, 255]

  Test_Colors[195] = [102, 102, 255]

  Test_Colors[196] = [153, 102, 255]

  Test_Colors[197] = [204, 102, 255]

  Test_Colors[198] = [255, 102, 255]

  Test_Colors[199] = [0, 153, 255]

  Test_Colors[200] = [51, 153, 255]

  Test_Colors[201] = [102, 153, 255]

  Test_Colors[202] = [153, 153, 255]

  Test_Colors[203] = [204, 153, 255]

  Test_Colors[204] = [255, 153, 255]

  Test_Colors[205] = [0, 204, 255]

  Test_Colors[206] = [51, 204, 25]

  Test_Colors[207] = [102, 204, 255]

  Test_Colors[208] = [153, 204, 255]

  Test_Colors[209] = [204, 204, 255]

  Test_Colors[210] = [255, 204, 255]

  Test_Colors[211] = [0, 255, 255]

  Test_Colors[212] = [51, 255, 255]

  Test_Colors[213] = [102, 255, 255]

  Test_Colors[214] = [153, 255, 255]

  Test_Colors[215] = [204, 255, 255]

  Test_Colors[216] = [255, 255, 255]  

  Test_Colors.default = [255, 255, 255, 255]

  @cache = {}

   def self.get_color(id)

      unless @cache.has_key?(id)

        @cache[id] = Color.new(*Test_Colors[id])

      end

      return @cache[id]

    end

end 

class Window_Base

#-----------------------------------------------------------------------------

  #--------------------------------------------------------------------------

  # * Get Text Color

  #--------------------------------------------------------------------------

   def text_color(n)

     return Plague180_Color.get_color(n)

  end

  #--------------------------------------------------------------------------

  # * Get Normal Text Color

  #--------------------------------------------------------------------------

  def normal_color

    return Plague180_Color.get_color('normal')

  end

  #--------------------------------------------------------------------------

  # * Get Disabled Text Color

  #--------------------------------------------------------------------------

  def disabled_color

    return Plague180_Color.get_color('disabled')

  end

  #--------------------------------------------------------------------------

  # * Get System Text Color

  #--------------------------------------------------------------------------

  def system_color

    return Plague180_Color.get_color('system')

  end

  #--------------------------------------------------------------------------

  # * Get Crisis Text Color

  #--------------------------------------------------------------------------

  def crisis_color

    return Plague180_Color.get_color('crisis')

  end

  #--------------------------------------------------------------------------

  # * Get Knockout Text Color

  #--------------------------------------------------------------------------

  def knockout_color

    return Plague180_Color.get_color('knockout')

  end 

end

 
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top