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:
Spaghetti-bit
2024-11-07 21:24:45 +00:00
committed by GitHub
co-authored by Contrabang Aylong Burzah
parent d0dc432024
commit afd52f006a
27 changed files with 1711 additions and 301 deletions
+27 -26
View File
@@ -818,9 +818,10 @@
M.change_gender(FEMALE)
if(eyes_organ)
var/new_eyes = input("Please select eye color.", "Character Generation", eyes_organ.eye_color) as null|color
if(new_eyes)
M.change_eye_color(new_eyes)
var/new_eyes = tgui_input_color(user, "Please select eye color.", "Character Generation", eyes_organ.eye_color)
if(isnull(new_eyes))
return
M.change_eye_color(new_eyes)
if(istype(head_organ))
//Alt heads.
@@ -838,14 +839,14 @@
if(new_style)
M.change_hair(new_style)
var/new_hair = input("Please select hair color.", "Character Generation", head_organ.hair_colour) as null|color
if(new_hair)
var/new_hair = tgui_input_color(user, "Please select hair color.", "Character Generation", head_organ.hair_colour)
if(!isnull(new_hair))
M.change_hair_color(new_hair)
var/datum/sprite_accessory/hair_style = GLOB.hair_styles_public_list[head_organ.h_style]
if(hair_style.secondary_theme && !hair_style.no_sec_colour)
new_hair = input("Please select secondary hair color.", "Character Generation", head_organ.sec_hair_colour) as null|color
if(new_hair)
new_hair = tgui_input_color(user, "Please select secondary hair color.", "Character Generation", head_organ.sec_hair_colour)
if(!isnull(new_hair))
M.change_hair_color(new_hair, TRUE)
// facial hair
@@ -855,25 +856,25 @@
if(new_style)
M.change_facial_hair(new_style)
var/new_facial = input("Please select facial hair color.", "Character Generation", head_organ.facial_colour) as null|color
if(new_facial)
var/new_facial = tgui_input_color(user, "Please select facial hair color.", "Character Generation", head_organ.facial_colour)
if(!isnull(new_facial))
M.change_facial_hair_color(new_facial)
var/datum/sprite_accessory/facial_hair_style = GLOB.facial_hair_styles_list[head_organ.f_style]
if(facial_hair_style.secondary_theme && !facial_hair_style.no_sec_colour)
new_facial = input("Please select secondary facial hair color.", "Character Generation", head_organ.sec_facial_colour) as null|color
if(new_facial)
new_facial = tgui_input_color(user, "Please select secondary facial hair color.", "Character Generation", head_organ.sec_facial_colour)
if(!isnull(new_facial))
M.change_facial_hair_color(new_facial, TRUE)
//Head accessory.
if(head_organ.dna.species.bodyflags & HAS_HEAD_ACCESSORY)
var/list/valid_head_accessories = M.generate_valid_head_accessories()
var/new_head_accessory = tgui_input_list(user, "Please select head accessory style", "Character Generation", valid_head_accessories)
if(new_head_accessory)
if(!isnull(new_head_accessory))
M.change_head_accessory(new_head_accessory)
var/new_head_accessory_colour = input("Please select head accessory colour.", "Character Generation", head_organ.headacc_colour) as null|color
if(new_head_accessory_colour)
var/new_head_accessory_colour = tgui_input_color(user, "Please select head accessory color.", "Character Generation", head_organ.headacc_colour)
if(!isnull(new_head_accessory_colour))
M.change_head_accessory_color(new_head_accessory_colour)
@@ -882,7 +883,7 @@
var/list/valid_body_accessories = M.generate_valid_body_accessories()
if(length(valid_body_accessories) > 1) //By default valid_body_accessories will always have at the very least a 'none' entry populating the list, even if the user's species is not present in any of the list items.
var/new_body_accessory = tgui_input_list(user, "Please select body accessory style", "Character Generation", valid_body_accessories)
if(new_body_accessory)
if(!isnull(new_body_accessory))
M.change_body_accessory(new_body_accessory)
if(istype(head_organ))
@@ -890,32 +891,32 @@
if(M.dna.species.bodyflags & HAS_HEAD_MARKINGS)
var/list/valid_head_markings = M.generate_valid_markings("head")
var/new_marking = tgui_input_list(user, "Please select head marking style", "Character Generation", valid_head_markings)
if(new_marking)
if(!isnull(new_marking))
M.change_markings(new_marking, "head")
var/new_marking_colour = input("Please select head marking colour.", "Character Generation", M.m_colours["head"]) as null|color
if(new_marking_colour)
var/new_marking_colour = tgui_input_color(user, "Please select head marking color.", "Character Generation", M.m_colours["head"])
if(!isnull(new_marking_colour))
M.change_marking_color(new_marking_colour, "head")
//Body markings.
if(M.dna.species.bodyflags & HAS_BODY_MARKINGS)
var/list/valid_body_markings = M.generate_valid_markings("body")
var/new_marking = tgui_input_list(user, "Please select body marking style", "Character Generation", valid_body_markings)
if(new_marking)
if(!isnull(new_marking))
M.change_markings(new_marking, "body")
var/new_marking_colour = input("Please select body marking colour.", "Character Generation", M.m_colours["body"]) as null|color
if(new_marking_colour)
var/new_marking_colour = tgui_input_color(user, "Please select body marking color.", "Character Generation", M.m_colours["body"])
if(!isnull(new_marking_colour))
M.change_marking_color(new_marking_colour, "body")
//Tail markings.
if(M.dna.species.bodyflags & HAS_TAIL_MARKINGS)
var/list/valid_tail_markings = M.generate_valid_markings("tail")
var/new_marking = tgui_input_list("Please select tail marking style", "Character Generation", valid_tail_markings)
if(new_marking)
if(!isnull(new_marking))
M.change_markings(new_marking, "tail")
var/new_marking_colour = input("Please select tail marking colour.", "Character Generation", M.m_colours["tail"]) as null|color
if(new_marking_colour)
var/new_marking_colour = tgui_input_color(user, "Please select tail marking color.", "Character Generation", M.m_colours["tail"])
if(!isnull(new_marking_colour))
M.change_marking_color(new_marking_colour, "tail")
//Skin tone.
@@ -944,8 +945,8 @@
//Skin colour.
if(M.dna.species.bodyflags & HAS_SKIN_COLOR)
var/new_body_colour = input("Please select body colour.", "Character Generation", M.skin_colour) as null|color
if(new_body_colour)
var/new_body_colour = tgui_input_color(user, "Please select body color.", "Character Generation", M.skin_colour)
if(!isnull(new_body_colour))
M.change_skin_color(new_body_colour)
M.update_dna()
+3 -1
View File
@@ -44,7 +44,9 @@
src.add_fingerprint(user)
if(stat & (BROKEN|NOPOWER))
return
var/temp = input(usr, "Choose a dye color", "Dye Color") as color
var/temp = tgui_input_color(user, "Please select a dye color", "Dye Color")
if(isnull(temp))
return
dye_color = temp
set_light(2, l_color = temp)
+6 -2
View File
@@ -292,7 +292,9 @@
if(!Adjacent(usr) || usr.incapacitated())
return
if(href_list["color"])
var/temp = input(usr, "Please select colour.", "Crayon colour") as color
var/temp = tgui_input_color(usr, "Please select crayon color.", "Crayon color")
if(isnull(temp))
return
colour = temp
update_window(usr)
else
@@ -328,7 +330,9 @@
if("Change Drawing")
..()
if("Change Color")
colour = input(user,"Choose Color") as color
colour = tgui_input_color(user,"Please select a paint color.","Spray Can Color")
if(isnull(colour))
return
update_icon()
/obj/item/toy/crayon/spraycan/afterattack(atom/target, mob/user as mob, proximity)
+1 -1
View File
@@ -41,7 +41,7 @@
/obj/structure/curtain/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/toy/crayon))
color = input(user, "Choose Color") as color
color = tgui_input_color(user,"Please choose a color.", "Curtain Color")
return
return ..()
@@ -69,8 +69,8 @@
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(!light_broken)
var/new_color = input(user, "Select a bulb color", "Select a bulb color", color) as color|null
if(!new_color)
var/new_color = tgui_input_color(user, "Select a bulb color", "Select a bulb color", color)
if(isnull(new_color))
return
// Cancel if they walked away