mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 11:05:03 +01:00
TGUI Color Picker (#26326)
* Init * Implements `tgui_input_color` * Implements most color wheel conversions to TGUI * Iteration two, went over titles and made sure most color inputs are functional. * Implements preferences for large buttons, swapped buttons, and disabled TGUI * Iteration three... the weird ones. (as null|color) * Removes `as color|null` and `as null|color` * Merge conflict resolution, again. * Color input bundle and panel bundle * CSLint being picky. * Picky `while ()` instead of `while()` * Apply suggestions from code review Co-authored-by: Aylong <69762909+AyIong@users.noreply.github.com> Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com> * WIP * de-bri'ish colour into color Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com> * Aylong review applied. - Removed an extra space in machine.dm - UI_STATE + Runechat color now uses TGUI_INPUT_COLOR * Apply suggestions from code review Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com> * Removes an unintentional space to `paradise.scss` * Update code/modules/tgui/tgui_input/color_input.dm Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com> * Adds "is_color" regex from TG * Fixes a few conflicting files * TGUI Merge conflict moment v3 * V4? * V5.... * God please don't explode. Builds TGUI like the linter wants. * Update code/modules/tgui/tgui_input/color_input.dm Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com> * Rebuilds TGUI, again <3 * Lint be damned --------- Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com> Co-authored-by: Aylong <69762909+AyIong@users.noreply.github.com> Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
This commit is contained in:
@@ -329,17 +329,16 @@
|
||||
|
||||
if("hair")
|
||||
if(!(S.bodyflags & BALD))
|
||||
var/input = "Choose your character's hair colour:"
|
||||
var/new_hair = input(user, input, "Character Preference", active_character.h_colour) as color|null
|
||||
if(new_hair)
|
||||
var/new_hair = tgui_input_color(user, "Choose your character's hair color.", "Character Preference", active_character.h_colour)
|
||||
if(!isnull(new_hair))
|
||||
active_character.h_colour = new_hair
|
||||
|
||||
if("secondary_hair")
|
||||
if(!(S.bodyflags & BALD))
|
||||
var/datum/sprite_accessory/hair_style = GLOB.hair_styles_public_list[active_character.h_style]
|
||||
if(hair_style.secondary_theme && !hair_style.no_sec_colour)
|
||||
var/new_hair = input(user, "Choose your character's secondary hair colour:", "Character Preference", active_character.h_sec_colour) as color|null
|
||||
if(new_hair)
|
||||
var/new_hair = tgui_input_color(user, "Choose your character's secondary hair color.", "Character Preference", active_character.h_sec_colour)
|
||||
if(!isnull(new_hair))
|
||||
active_character.h_sec_colour = new_hair
|
||||
|
||||
if("h_style")
|
||||
@@ -387,9 +386,10 @@
|
||||
active_character.h_grad_offset_y = clamp(text2num(expl[2]) || 0, -16, 16)
|
||||
|
||||
if("h_grad_colour")
|
||||
var/result = input(user, "Choose your character's hair gradient colour:", "Character Preference", active_character.h_grad_colour) as color|null
|
||||
if(result)
|
||||
active_character.h_grad_colour = result
|
||||
var/result = tgui_input_color(user, "Choose your character's hair gradient color:", "Character Preference", active_character.h_grad_colour)
|
||||
if(isnull(result))
|
||||
return
|
||||
active_character.h_grad_colour = result
|
||||
|
||||
if("h_grad_alpha")
|
||||
var/result = tgui_input_number(user, "Choose your character's hair gradient alpha (0-255):", "Character Preference", active_character.h_grad_alpha, 255)
|
||||
@@ -398,16 +398,17 @@
|
||||
active_character.h_grad_alpha = clamp(result, 0, 255)
|
||||
|
||||
if("runechat_color")
|
||||
var/result = input(user, "Choose your character's runechat color:", "Character Preference", active_character.runechat_color) as color|null
|
||||
if(result)
|
||||
active_character.runechat_color = result
|
||||
var/result = tgui_input_color(user, "Choose your character's runechat color:", "Character Preference", active_character.runechat_color)
|
||||
if(isnull(result))
|
||||
return
|
||||
active_character.runechat_color = result
|
||||
|
||||
if("headaccessory")
|
||||
if(S.bodyflags & HAS_HEAD_ACCESSORY) //Species with head accessories.
|
||||
var/input = "Choose the colour of your your character's head accessory:"
|
||||
var/new_head_accessory = input(user, input, "Character Preference", active_character.hacc_colour) as color|null
|
||||
if(new_head_accessory)
|
||||
active_character.hacc_colour = new_head_accessory
|
||||
var/new_head_accessory = tgui_input_color(user, "Choose the color of your your character's head accessory.", "Character Preference", active_character.hacc_colour)
|
||||
if(isnull(new_head_accessory))
|
||||
return
|
||||
active_character.hacc_colour = new_head_accessory
|
||||
|
||||
if("ha_style")
|
||||
if(S.bodyflags & HAS_HEAD_ACCESSORY) //Species with head accessories.
|
||||
@@ -485,10 +486,10 @@
|
||||
|
||||
if("m_head_colour")
|
||||
if(S.bodyflags & HAS_HEAD_MARKINGS) //Species with head markings.
|
||||
var/input = "Choose the colour of your your character's head markings:"
|
||||
var/new_markings = input(user, input, "Character Preference", active_character.m_colours["head"]) as color|null
|
||||
if(new_markings)
|
||||
active_character.m_colours["head"] = new_markings
|
||||
var/new_markings = tgui_input_color(user, "Choose the color of your your character's head markings.", "Character Preference", active_character.m_colours["head"])
|
||||
if(isnull(new_markings))
|
||||
return
|
||||
active_character.m_colours["head"] = new_markings
|
||||
|
||||
if("m_style_body")
|
||||
if(S.bodyflags & HAS_BODY_MARKINGS) //Species with body markings/tattoos.
|
||||
@@ -508,10 +509,10 @@
|
||||
|
||||
if("m_body_colour")
|
||||
if(S.bodyflags & HAS_BODY_MARKINGS) //Species with body markings/tattoos.
|
||||
var/input = "Choose the colour of your your character's body markings:"
|
||||
var/new_markings = input(user, input, "Character Preference", active_character.m_colours["body"]) as color|null
|
||||
if(new_markings)
|
||||
active_character.m_colours["body"] = new_markings
|
||||
var/new_markings = tgui_input_color(user, "Choose the color of your your character's body markings.", "Character Preference", active_character.m_colours["body"])
|
||||
if(isnull(new_markings))
|
||||
return
|
||||
active_character.m_colours["body"] = new_markings
|
||||
|
||||
if("m_style_tail")
|
||||
if(S.bodyflags & HAS_TAIL_MARKINGS) //Species with tail markings.
|
||||
@@ -537,10 +538,10 @@
|
||||
|
||||
if("m_tail_colour")
|
||||
if(S.bodyflags & HAS_TAIL_MARKINGS) //Species with tail markings.
|
||||
var/input = "Choose the colour of your your character's tail markings:"
|
||||
var/new_markings = input(user, input, "Character Preference", active_character.m_colours["tail"]) as color|null
|
||||
if(new_markings)
|
||||
active_character.m_colours["tail"] = new_markings
|
||||
var/new_markings = tgui_input_color(user, "Choose the color of your your character's tail markings.", "Character Preference", active_character.m_colours["tail"])
|
||||
if(isnull(new_markings))
|
||||
return
|
||||
active_character.m_colours["tail"] = new_markings
|
||||
|
||||
if("body_accessory")
|
||||
var/list/possible_body_accessories = list()
|
||||
@@ -565,17 +566,19 @@
|
||||
|
||||
if("facial")
|
||||
if(!(S.bodyflags & SHAVED))
|
||||
var/new_facial = input(user, "Choose your character's facial-hair colour:", "Character Preference", active_character.f_colour) as color|null
|
||||
if(new_facial)
|
||||
active_character.f_colour = new_facial
|
||||
var/new_facial = tgui_input_color(user, "Choose your character's facial-hair color:", "Character Preference", active_character.f_colour)
|
||||
if(isnull(new_facial))
|
||||
return
|
||||
active_character.f_colour = new_facial
|
||||
|
||||
if("secondary_facial")
|
||||
if(!(S.bodyflags & SHAVED))
|
||||
var/datum/sprite_accessory/facial_hair_style = GLOB.facial_hair_styles_list[active_character.f_style]
|
||||
if(facial_hair_style.secondary_theme && !facial_hair_style.no_sec_colour)
|
||||
var/new_facial = input(user, "Choose your character's secondary facial-hair colour:", "Character Preference", active_character.f_sec_colour) as color|null
|
||||
if(new_facial)
|
||||
active_character.f_sec_colour = new_facial
|
||||
var/new_facial = tgui_input_color(user, "Choose your character's secondary facial-hair color:", "Character Preference", active_character.f_sec_colour)
|
||||
if(isnull(new_facial))
|
||||
return
|
||||
active_character.f_sec_colour = new_facial
|
||||
|
||||
if("f_style")
|
||||
var/list/valid_facial_hairstyles = list()
|
||||
@@ -658,34 +661,37 @@
|
||||
active_character.socks = new_socks
|
||||
|
||||
if("eyes")
|
||||
var/new_eyes = input(user, "Choose your character's eye colour:", "Character Preference", active_character.e_colour) as color|null
|
||||
if(new_eyes)
|
||||
active_character.e_colour = new_eyes
|
||||
var/new_eyes = tgui_input_color(user, "Choose your character's eye color:", "Character Preference", active_character.e_colour)
|
||||
if(isnull(new_eyes))
|
||||
return
|
||||
active_character.e_colour = new_eyes
|
||||
|
||||
if("s_tone")
|
||||
if(S.bodyflags & HAS_SKIN_TONE)
|
||||
var/new_s_tone = input(user, "Choose your character's skin-tone:\n(Light 1 - 220 Dark)", "Character Preference") as num|null
|
||||
if(!new_s_tone)
|
||||
if(isnull(new_s_tone))
|
||||
return
|
||||
active_character.s_tone = 35 - max(min(round(new_s_tone), 220), 1)
|
||||
else if(S.bodyflags & HAS_ICON_SKIN_TONE)
|
||||
var/const/MAX_LINE_ENTRIES = 4
|
||||
var/prompt = "Choose your character's skin tone: 1-[length(S.icon_skin_tones)]\n(Light to Dark)"
|
||||
var/skin_c = tgui_input_number(user, prompt, "Character Preference", active_character.s_tone, length(S.icon_skin_tones), 1)
|
||||
if(!skin_c)
|
||||
if(isnull(skin_c))
|
||||
return
|
||||
active_character.s_tone = skin_c
|
||||
|
||||
if("skin")
|
||||
if((S.bodyflags & HAS_SKIN_COLOR) || GLOB.body_accessory_by_species[active_character.species] || check_rights(R_ADMIN, 0, user))
|
||||
var/new_skin = input(user, "Choose your character's skin colour: ", "Character Preference", active_character.s_colour) as color|null
|
||||
if(new_skin)
|
||||
active_character.s_colour = new_skin
|
||||
var/new_skin = tgui_input_color(user, "Choose your character's skin color: ", "Character Preference", active_character.s_colour)
|
||||
if(isnull(new_skin))
|
||||
return
|
||||
active_character.s_colour = new_skin
|
||||
|
||||
if("ooccolor")
|
||||
var/new_ooccolor = input(user, "Choose your OOC colour:", "Game Preference", ooccolor) as color|null
|
||||
if(new_ooccolor)
|
||||
ooccolor = new_ooccolor
|
||||
var/new_ooccolor = tgui_input_color(user, "Choose your OOC color:", "Game Preference", ooccolor)
|
||||
if(isnull(new_ooccolor))
|
||||
return
|
||||
ooccolor = new_ooccolor
|
||||
|
||||
if("bag")
|
||||
var/new_backbag = tgui_input_list(user, "Choose your character's style of bag", "Character Preference", GLOB.backbaglist)
|
||||
@@ -1015,8 +1021,9 @@
|
||||
toggles2 ^= PREFTOGGLE_2_AFKWATCH
|
||||
|
||||
if("UIcolor")
|
||||
var/UI_style_color_new = input(user, "Choose your UI color, dark colors are not recommended!", UI_style_color) as color|null
|
||||
if(!UI_style_color_new) return
|
||||
var/UI_style_color_new = tgui_input_color(user, "Choose your UI color, dark colors are not recommended!", "Game Preference", UI_style_color)
|
||||
if(isnull(UI_style_color_new))
|
||||
return
|
||||
UI_style_color = UI_style_color_new
|
||||
|
||||
if(ishuman(usr)) //mid-round preference changes, for aesthetics
|
||||
@@ -1151,9 +1158,10 @@
|
||||
screentip_mode = desired_screentip_mode
|
||||
|
||||
if("screentip_color")
|
||||
var/screentip_color_new = input(user, "Choose your screentip color", screentip_color) as color|null
|
||||
if(screentip_color_new)
|
||||
screentip_color = screentip_color_new
|
||||
var/screentip_color_new = tgui_input_color(user, "Choose your screentip color", "Game Preference", screentip_color)
|
||||
if(isnull(screentip_color_new))
|
||||
return
|
||||
screentip_color = screentip_color_new
|
||||
|
||||
if("edit_2fa")
|
||||
// Do this async so we arent holding up a topic() call
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
/datum/gear_tweak/color/get_metadata(user, metadata)
|
||||
if(valid_colors)
|
||||
return input(user, "Choose an item color.", "Character Preference", metadata) as null|anything in valid_colors
|
||||
return input(user, "Choose an item color.", "Global Preference", metadata) as color|null
|
||||
return tgui_input_color(user, "Choose an item color.", "Global Preference", metadata)
|
||||
|
||||
/datum/gear_tweak/color/tweak_item(obj/item/I, metadata)
|
||||
if(valid_colors && !(metadata in valid_colors))
|
||||
|
||||
@@ -510,8 +510,8 @@
|
||||
blackbox_message = "Set Own OOC"
|
||||
|
||||
/datum/preference_toggle/special_toggle/set_ooc_color/set_toggles(client/user)
|
||||
var/new_ooccolor = input(usr, "Please select your OOC color.", "OOC color", user.prefs.ooccolor) as color|null
|
||||
if(new_ooccolor)
|
||||
var/new_ooccolor = tgui_input_color(usr, "Please select your OOC color.", "OOC Color", user.prefs.ooccolor)
|
||||
if(!isnull(new_ooccolor))
|
||||
user.prefs.ooccolor = new_ooccolor
|
||||
to_chat(usr, "Your OOC color has been set to [new_ooccolor].")
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user