Skip to content

Commit

Permalink
[PORT] TGUI Colour Picker From Bee (#525)
Browse files Browse the repository at this point in the history
  • Loading branch information
RimiNosha authored Jan 12, 2024
1 parent 58d6ef6 commit 60c79c0
Show file tree
Hide file tree
Showing 36 changed files with 1,780 additions and 118 deletions.
2 changes: 1 addition & 1 deletion code/datums/browser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@
if ("number")
settings["mainsettings"][setting]["value"] = input(user, "Enter new value for [settings["mainsettings"][setting]["desc"]]", "Enter new value for [settings["mainsettings"][setting]["desc"]]") as num
if ("color")
settings["mainsettings"][setting]["value"] = input(user, "Enter new value for [settings["mainsettings"][setting]["desc"]]", "Enter new value for [settings["mainsettings"][setting]["desc"]]", settings["mainsettings"][setting]["value"]) as color
settings["mainsettings"][setting]["value"] = tgui_color_picker(user, "Enter new value for [settings["mainsettings"][setting]["desc"]]", "Enter new value for [settings["mainsettings"][setting]["desc"]]", settings["mainsettings"][setting]["value"])
if ("boolean")
settings["mainsettings"][setting]["value"] = (settings["mainsettings"][setting]["value"] == "Yes") ? "No" : "Yes"
if ("ckey")
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/palette.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
var/is_right_clicking = LAZYACCESS(params2list(params), RIGHT_CLICK)
var/index = text2num(choice)
if(is_right_clicking)
var/chosen_color = input(user, "Pick new color", "[parent]", colors[index]) as color|null
var/chosen_color = tgui_color_picker(user, "Pick new color", "[parent]", colors[index])
if(chosen_color && !QDELETED(src) && !IS_DEAD_OR_INCAP(user) && user.is_holding(parent))
colors[index] = chosen_color
update_radial_list()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons

/// Common proc used by painting tools like spraycans and palettes that can access the entire 24 bits color space.
/obj/item/proc/pick_painting_tool_color(mob/user, default_color)
var/chosen_color = input(user,"Pick new color", "[src]", default_color) as color|null
var/chosen_color = tgui_color_picker(user,"Pick new color", "[src]", default_color)
if(!chosen_color || QDELETED(src) || IS_DEAD_OR_INCAP(user) || !user.is_holding(src))
return
set_painting_tool_color(chosen_color)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/RCD.dm
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ GLOBAL_VAR_INIT(icon_holographic_window, init_holographic_window())

/obj/item/construction/rld/ui_action_click(mob/user, datum/action/A)
if(istype(A, /datum/action/item_action/pick_color))
color_choice = input(user,"","Choose Color",color_choice) as color
color_choice = tgui_color_picker(user,"","Choose Color",color_choice)
else
..()

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/dyekit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE))
return

var/new_grad_color = input(user, "Choose a secondary hair color:", "Character Preference",human_target.grad_color) as color|null
var/new_grad_color = tgui_color_picker(user, "Choose a secondary hair color:", "Character Preference",human_target.grad_color)
if(!new_grad_color || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE) || !user.CanReach(target))
return

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/paint.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
. += span_notice("Choose any color by alt-clicking the paint.")

/obj/item/paint/anycolor/AltClick(mob/living/user)
var/new_paint_color = input(user, "Choose new paint color", "Paint Color", paint_color) as color|null
var/new_paint_color = tgui_color_picker(user, "Choose new paint color", "Paint Color", paint_color)
if(new_paint_color)
paint_color = new_paint_color
icon_state = "paint_neutral"
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/stacks/wrap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
set_greyscale(colors = list(generated_base_color, generated_ribbon_color))

/obj/item/stack/wrapping_paper/attack_hand_secondary(mob/user, modifiers)
var/new_base = input(user, "", "Select a base color", color) as color
var/new_ribbon = input(user, "", "Select a ribbon color", color) as color
var/new_base = tgui_color_picker(user, "", "Select a base color", color)
var/new_ribbon = tgui_color_picker(user, "", "Select a ribbon color", color)
if(!user.canUseTopic(src, BE_CLOSE))
return
set_greyscale(colors = list(new_base, new_ribbon))
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/dresser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
if(new_undies)
dressing_human.underwear = new_undies
if("Underwear Color")
var/new_underwear_color = input(dressing_human, "Choose your underwear color", "Underwear Color", dressing_human.underwear_color) as color|null
var/new_underwear_color = tgui_color_picker(dressing_human, "Choose your underwear color", "Underwear Color", dressing_human.underwear_color)
if(new_underwear_color)
dressing_human.underwear_color = sanitize_hexcolor(new_underwear_color)
if("Undershirt")
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/maintenance.dm
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ at the cost of risking a vicious bite.**/
var/altar_result = show_radial_menu(user, src, altar_options, custom_check = CALLBACK(src, PROC_REF(check_menu), user), require_near = TRUE, tooltips = TRUE)
switch(altar_result)
if("Change Color")
var/chosen_color = input(user, "", "Choose Color", pants_color) as color|null
var/chosen_color = tgui_color_picker(user, "", "Choose Color", pants_color)
if(!isnull(chosen_color) && user.canUseTopic(src, BE_CLOSE))
pants_color = chosen_color
if("Create Artefact")
Expand Down
8 changes: 4 additions & 4 deletions code/game/objects/structures/mirror.dm
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
amazed_human.dna.update_ui_block(DNA_SKIN_TONE_BLOCK)

if(MUTCOLORS in amazed_human.dna.species.species_traits)
var/new_mutantcolor = input(user, "Choose your skin color:", "Race change", amazed_human.skin_tone) as color|null
var/new_mutantcolor = tgui_color_picker(user, "Choose your skin color:", "Race change", amazed_human.skin_tone)
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return TRUE
if(new_mutantcolor)
Expand Down Expand Up @@ -239,21 +239,21 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
if(hairchoice == "Style") //So you just want to use a mirror then?
return ..()
else
var/new_hair_color = input(amazed_human, "Choose your hair color", "Hair Color",amazed_human.hair_color) as color|null
var/new_hair_color = tgui_color_picker(amazed_human, "Choose your hair color", "Hair Color",amazed_human.hair_color)
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return TRUE
if(new_hair_color)
amazed_human.hair_color = sanitize_hexcolor(new_hair_color)
amazed_human.dna.update_ui_block(DNA_HAIR_COLOR_BLOCK)
if(amazed_human.gender == "male")
var/new_face_color = input(amazed_human, "Choose your facial hair color", "Hair Color", amazed_human.facial_hair_color) as color|null
var/new_face_color = tgui_color_picker(amazed_human, "Choose your facial hair color", "Hair Color", amazed_human.facial_hair_color)
if(new_face_color)
amazed_human.facial_hair_color = sanitize_hexcolor(new_face_color)
amazed_human.dna.update_ui_block(DNA_FACIAL_HAIR_COLOR_BLOCK)
amazed_human.update_body_parts()

if(BODY_ZONE_PRECISE_EYES)
var/new_eye_color = input(amazed_human, "Choose your eye color", "Eye Color", amazed_human.eye_color_left) as color|null
var/new_eye_color = tgui_color_picker(amazed_human, "Choose your eye color", "Eye Color", amazed_human.eye_color_left)
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return TRUE
if(new_eye_color)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/watercloset.dm
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/sink/kitchen, (-16))

/obj/structure/curtain/attackby(obj/item/W, mob/user)
if (istype(W, /obj/item/toy/crayon))
color = input(user,"","Choose Color",color) as color
color = tgui_color_picker(user,"","Choose Color",color)
else
return ..()

Expand Down
4 changes: 2 additions & 2 deletions code/modules/admin/greyscale_modify_menu.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@

if("pick_color")
var/group = params["color_index"]
var/new_color = input(
var/new_color = tgui_color_picker(
usr,
"Choose color for greyscale color group [group]:",
"Greyscale Modification Menu",
split_colors[group]
) as color|null
)
if(new_color)
split_colors[group] = new_color
queue_refresh()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/view_variables/filterrific.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
target.add_filter(params["name"], old_filter_data["priority"], new_filter_data)
. = TRUE
if("modify_color_value")
var/new_color = input(usr, "Pick new filter color", "Filteriffic Colors!") as color|null
var/new_color = tgui_color_picker(usr, "Pick new filter color", "Filteriffic Colors!")
if(new_color)
target.transition_filter(params["name"], 4, list("color" = new_color))
. = TRUE
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/view_variables/get_variables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
.["value"] = D

if(VV_COLOR)
.["value"] = input("Enter new color:", "Color", current_value) as color|null
.["value"] = tgui_color_picker("Enter new color:", "Color", current_value)
if(.["value"] == null)
.["class"] = null
return
Expand Down
2 changes: 1 addition & 1 deletion code/modules/art/paintings.dm
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
return FALSE
//I'd have this done inside the signal, but that'd have to be asynced,
//while we want the UI to be updated after the color is chosen, not before.
var/chosen_color = input(user, "Pick new color", painting_implement, params["old_color"]) as color|null
var/chosen_color = tgui_color_picker(user, "Pick new color", painting_implement, params["old_color"])
if(!chosen_color || IS_DEAD_OR_INCAP(user) || !user.is_holding(painting_implement))
return FALSE
SEND_SIGNAL(painting_implement, COMSIG_PAINTING_TOOL_PALETTE_COLOR_CHANGED, chosen_color, params["color_index"])
Expand Down
8 changes: 4 additions & 4 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,12 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/old_value = read_preference(requested_preference.type)

// Yielding
var/new_color = input(
var/new_color = tgui_color_picker(
usr,
"Select new color",
null,
old_value || COLOR_WHITE,
) as color | null
)

if (!new_color)
return FALSE
Expand Down Expand Up @@ -310,12 +310,12 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/old_value = old_value_list[index_key]

// Yielding
var/new_color = input(
var/new_color = tgui_color_picker(
usr,
"Select new color",
null,
"#[old_value]" || COLOR_WHITE,
) as color | null
)

if (!new_color)
return FALSE
Expand Down
2 changes: 1 addition & 1 deletion code/modules/client/verbs/ooc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
set category = "Server"
if(IsAdminAdvancedProcCall())
return
var/newColor = input(src, "Please select the new player OOC color.", "OOC color") as color|null
var/newColor = tgui_color_picker(src, "Please select the new player OOC color.", "OOC color")
if(isnull(newColor))
return
if(!check_rights(R_FUN))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/head/wig.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

/obj/item/clothing/head/wig/attack_self(mob/user)
var/new_style = tgui_input_list(user, "Select a hairstyle", "Wig Styling", GLOB.hairstyles_list - "Bald")
var/newcolor = adjustablecolor ? input(usr,"","Choose Color",color) as color|null : null
var/newcolor = adjustablecolor ? tgui_color_picker(usr,"","Choose Color",color) : null
if(!user.canUseTopic(src, BE_CLOSE))
return
if(new_style && new_style != hairstyle)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/simple_animal/guardian/guardian.dm
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians
guardianrecolor()

/mob/living/simple_animal/hostile/guardian/proc/guardianrecolor()
guardiancolor = input(src,"What would you like your color to be?","Choose Your Color","#ffffff") as color|null
guardiancolor = tgui_color_picker(src,"What would you like your color to be?","Choose Your Color","#ffffff")
if(!guardiancolor) //redo proc until we get a color
to_chat(src, span_warning("Not a valid color, please try again."))
guardianrecolor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
* If an invalid color is given, will re-prompt the dragon until a proper color is chosen.
*/
/mob/living/simple_animal/hostile/space_dragon/proc/color_selection()
chosen_color = input(src,"What would you like your color to be?","Choose Your Color", COLOR_WHITE) as color|null
chosen_color = tgui_color_picker(src,"What would you like your color to be?","Choose Your Color", COLOR_WHITE)
if(!chosen_color) //redo proc until we get a color
to_chat(src, span_warning("Not a valid color, please try again."))
color_selection()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mod/modules/modules_general.dm
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
/obj/item/mod/module/flashlight/configure_edit(key, value)
switch(key)
if("light_color")
value = input(usr, "Pick new light color", "Flashlight Color") as color|null
value = tgui_color_picker(usr, "Pick new light color", "Flashlight Color")
if(!value)
return
if(is_color_dark(value, 50))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
var/mob/user = usr
var/new_color
while(!new_color)
new_color = input(user, "Choose a new color for [src]'s flashlight.", "Light Color",light_color) as color|null
new_color = tgui_color_picker(user, "Choose a new color for [src]'s flashlight.", "Light Color",light_color)
if(!new_color)
return
if(is_color_dark(new_color, 50) ) //Colors too dark are rejected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,4 +532,4 @@
desc = "Causes kinetic accelerator bolts to have an adjustable-colored tracer trail and explosion. Use in-hand to change color."

/obj/item/borg/upgrade/modkit/tracer/adjustable/attack_self(mob/user)
bolt_color = input(user,"","Choose Color",bolt_color) as color|null
bolt_color = tgui_color_picker(user,"","Choose Color",bolt_color)
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Slimecrossing Armor
if(!IsAvailable())
return
var/obj/item/clothing/glasses/prism_glasses/glasses = target
var/new_color = input(owner, "Choose the lens color:", "Color change",glasses.glasses_color) as color|null
var/new_color = tgui_color_picker(owner, "Choose the lens color:", "Color change",glasses.glasses_color)
if(!new_color)
return
glasses.glasses_color = new_color
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Prismatic extracts:
colour = "rainbow"

/obj/item/slimecross/prismatic/rainbow/attack_self(mob/user)
var/newcolor = input(user, "Choose the slime color:", "Color change",paintcolor) as color|null
var/newcolor = tgui_color_picker(user, "Choose the slime color:", "Color change",paintcolor)
if(user.get_active_held_item() != src || user.stat != CONSCIOUS || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED))
return
if(!newcolor)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/organs/eyes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@
activate()

/obj/item/organ/internal/eyes/robotic/glow/proc/prompt_for_controls(mob/user)
var/color = input(owner, "Select Color", "Select color", "#ffffff") as color|null
var/color = tgui_color_picker(owner, "Select Color", "Select color", "#ffffff")
if(!color || QDELETED(src) || QDELETED(user) || QDELETED(owner) || owner != user)
return
var/range = input(user, "Enter range (0 - [max_light_beam_distance])", "Range Select", 0) as null|num
Expand Down
Loading

0 comments on commit 60c79c0

Please sign in to comment.