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.

Changing font colours

ok people, you guys seem like you will help, I am new to scripting, i can change the font and little things, but all I want to know is how to change the colour of it.

is this possible at all?

with the very little scripting i know, i have tryed and tryed but cant do it.

Thanks in advance!

(P.S)* i want to make it black
 
rocknroll93":30niu1oq said:
ok people, you guys seem like you will help, I am new to scripting, i can change the font and little things, but all I want to know is how to change the colour of it.

is this possible at all?

with the very little scripting i know, i have tryed and tryed but cant do it.

Thanks in advance!

(P.S)* i want to make it black

OK, you'll need to put in some code, from what I can recall (unless you just want to change the message color) Anyway, here goes:

font.color(red,green,blue,alpha)

Red, Green, and Blue are all the total of that color, from 0 to 255. If they are all 255, it is white, but if they are all 0, it is black. Also, alpha is the transparency, where 0 is invisible and 255 is opaque.

Otherwise, for event messages, just type \C[n], where n is:

0 for white, 1 for blue, 2 for red, 3 for green, 4 for cyan, 5 for magenta, 6 for yellow, and 7 for a semi-dark gray.

Since you want black text, you'll probably have to do:

font.color(0,0,0,255)
 

khmp

Sponsor

To change the color that will be used when no other color is mentioned the line would be:
Code:
Font.default_color = Color.new(0, 0, 0) # Black
And that could be placed directly above main. When the last component, which is alpha, is 255 you can omit it.

That will change the default color for any text drawing where color is not mentioned. However this doesn't affect any default windows that are built into the game. These use the methods in Window_Base to determine the color used. You would need to override these methods for the sake of consistency. Insert an empty section above main and copy and paste the code below. Play around with the colors till you get the appropriate result.
Code:
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Get Text Color
  #     n : text color number (0-7)
  #--------------------------------------------------------------------------
  def text_color(n)
    case n
    when 0
      return Color.new(255, 255, 255, 255) # White
    when 1
      return Color.new(128, 128, 255, 255) # Blue
    when 2
      return Color.new(255, 128, 128, 255) # Red
    when 3
      return Color.new(128, 255, 128, 255) # Green
    when 4
      return Color.new(128, 255, 255, 255) # Cyan
    when 5
      return Color.new(255, 128, 255, 255) # Magenta
    when 6
      return Color.new(255, 255, 128, 255) # Yellow
    when 7
      return Color.new(192, 192, 192, 255) # Gray
    else
      normal_color
    end
  end
  #--------------------------------------------------------------------------
  # * Get Normal Text Color
  #--------------------------------------------------------------------------
  def normal_color
    return Color.new(255, 255, 255, 255) # White
  end
  #--------------------------------------------------------------------------
  # * Get Disabled Text Color
  #--------------------------------------------------------------------------
  def disabled_color
    return Color.new(255, 255, 255, 128) # Faded White looks Gray
  end
  #--------------------------------------------------------------------------
  # * Get System Text Color
  #--------------------------------------------------------------------------
  def system_color
    return Color.new(192, 224, 255, 255) # Blue-ish
  end
  #--------------------------------------------------------------------------
  # * Get Crisis Text Color
  #--------------------------------------------------------------------------
  def crisis_color
    return Color.new(255, 255, 64, 255) # Yellow-ish
  end
  #--------------------------------------------------------------------------
  # * Get Knockout Text Color
  #--------------------------------------------------------------------------
  def knockout_color
    return Color.new(255, 64, 0) # Bright Red
  end
end

Good luck with it rocknroll93! :thumb:
 

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