Save-Point
Hex Colors RG - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker VX/VXAce (RGSS2/3) Engines (https://www.save-point.org/forum-117.html)
+---- Thread: Hex Colors RG (/thread-13316.html)



Hex Colors RG - kyonides - 11-18-2025

Hex Colors RG

by Kyonides

Introduction

I'm back to leave you another scriptlet that will allow you to use hex colors in your windows and sprites with ease.

This code will work on RMXP, RMVX and even RMVX ACE! Shocked

Just use it like this:

For Windows:
Code:
self.contents.font.color = hex_color("FF00FF")

For Sprites:
Code:
self.bitmap.font.color = hex_color("FF00FF")

In this particular case, your text will become purple-ish! Virus 

You can also add 2 extra characters to set the alpha value of your custom color manually.

In both cases you can add the # pound sign at the beginning of the string, but it's not mandatory.

The Script

Code:
# * Hex Colors RG * #
#  Scripter : Kyonides
#  2025-11-18

module Hex
  def hex_color(hex)
    digits = hex.size
    hex.sub!("#", "")
    red = hex[0, 2].to_i(16)
    green = hex[2, 2].to_i(16)
    blue = hex[4, 2].to_i(16)
    alpha = digits == 8 ? hex[6, 2] : 255
    Color.new(red, green, blue, alpha)
  end
end

class Window_Base
  include Hex
end

class Sprite
  include Hex
end

Terms & Conditions

It's free as in Beer beer. That's all you need to know. Winking