From 18ffd4fb942b6204efa80bf8600b1dbeef21ee8d Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Fri, 19 Aug 2022 21:40:46 +0100 Subject: [PATCH] Fix to colour-stringifying methods --- Data/Scripts/001_Technical/002_RubyUtilities.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Data/Scripts/001_Technical/002_RubyUtilities.rb b/Data/Scripts/001_Technical/002_RubyUtilities.rb index 70e4b3bd4..6fc2184fa 100644 --- a/Data/Scripts/001_Technical/002_RubyUtilities.rb +++ b/Data/Scripts/001_Technical/002_RubyUtilities.rb @@ -229,21 +229,21 @@ class Color # @return [String] the 15-bit representation of this color in a string, ignoring its alpha def to_rgb15 - ret = (self.red >> 3) - ret |= ((self.green >> 3) << 5) - ret |= ((self.blue >> 3) << 10) + ret = (self.red.to_i >> 3) + ret |= ((self.green.to_i >> 3) << 5) + ret |= ((self.blue.to_i >> 3) << 10) return sprintf("%04X", ret) end # @return [String] this color in the format "RRGGBB", ignoring its alpha def to_rgb24 - return sprintf("%02X%02X%02X", self.red, self.green, self.blue) + return sprintf("%02X%02X%02X", self.red.to_i, self.green.to_i, self.blue.to_i) end # @return [String] this color in the format "RRGGBBAA" (or "RRGGBB" if this color's alpha is 255) def to_rgb32(always_include_alpha = false) - return sprintf("%02X%02X%02X", self.red, self.green, self.blue) if self.alpha == 255 && !always_include_alpha - return sprintf("%02X%02X%02X%02X", self.red, self.green, self.blue, self.alpha) + return sprintf("%02X%02X%02X", self.red.to_i, self.green.to_i, self.blue.to_i) if self.alpha.to_i == 255 && !always_include_alpha + return sprintf("%02X%02X%02X%02X", self.red.to_i, self.green.to_i, self.blue.to_i, self.alpha.to_i) end # @return [String] this color in the format "#RRGGBB", ignoring its alpha