Code:
# * Command Color XP * #
# Scripter : Kyonides
# v0.5.0 - 2025-06-15
# The SELECT_COLOR Constant lets you configure your custom color following
# the usual (R,G,B) or (R,G,B,A) color format.
class Window_Command
SELECT_COLOR = Color.new(255, 255, 0)
DISABLED_ALPHA = 100
alias :kyon_cmd_clr_win_comm_init :initialize
alias :kyon_cmd_clr_win_comm_set_index :index=
alias :kyon_cmd_clr_win_comm_dis_item :disable_item
alias :kyon_cmd_clr_win_comm_up :update
def initialize(width, commands)
@disabled = []
@last_pos = -1
kyon_cmd_clr_win_comm_init(width, commands)
end
def index=(new_index)
return if @index == new_index
if @index >= 0
last_color = @disabled.include?(@index)? disabled_color : normal_color
draw_item(@index, last_color)
@last_pos = @index
end
kyon_cmd_clr_win_comm_set_index(new_index)
update_command_color
end
def disable_item(index)
@disabled << index
@disabled = @disabled.sort.uniq
kyon_cmd_clr_win_comm_dis_item(index)
end
def update_command
return if @last_pos == @index
if @last_pos >= 0
last_color = @disabled.include?(@last_pos)? disabled_color : normal_color
draw_item(@last_pos, last_color)
end
update_command_color
@last_pos = @index
end
def update_command_color
new_color = SELECT_COLOR.dup
new_color.alpha = @disabled.include?(@index)? DISABLED_ALPHA : 255
draw_item(@index, new_color)
end
def update
kyon_cmd_clr_win_comm_up
update_command
end
end