godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.41k stars 21.06k forks source link

Suggestion : add predefined colors #6195

Closed thomasbaijot closed 7 years ago

thomasbaijot commented 8 years ago

Operating system or device - Godot version: v2.1 stable official

Issue description (what happened, and what was expected): Colors have to be built manualy with Color8(r, g, b, a). I suggest creating predefined colors : Color8.red, Color8.purple, ... I think that Color8.teal is more readable than Color8(0,128,128,255).

Link to minimal example project (optional but very welcome): Here is a color chart with official color names and their RGB code : http://www.workwithcolor.com/color-chart-full-01.htm

LeonardMeagher2 commented 8 years ago

!!Check later comment for code!!

thomasbaijot commented 8 years ago

@LeonardMeagher2 : Wow, nice, that works great ! 1 - How did you extract this list ? Not 1 by 1 i hope... 2 - Could you do the same with Color8() and keep the 0-255 values ? 3 - Will it be added to the default build of Godot or in the AssetLib ?

LeonardMeagher2 commented 8 years ago

@thomasbaijot I used javascript on the website to get the names and values for each color (and did it on another for a more complete list)


Color8 was a better choice

extends Node

const AirForceBlue = Color8(93,138,168)
const AliceBlue = Color8(240,248,255)
const Alizarin = Color8(227,38,54)
const Amaranth = Color8(229,43,80)
const Amber = Color8(255,191,0)
const AndroidGreen = Color8(164,198,57)
const AppleGreen = Color8(141,182,0)
const Apricot = Color8(251,206,177)
const Aquamarine = Color8(127,255,212)
const ArmyGreen = Color8(75,83,32)
const Arsenic = Color8(59,68,75)
const ArylideYellow = Color8(233,214,107)
const AshGrey = Color8(178,190,181)
const Asparagus = Color8(135,169,107)
const AtomicTangerine = Color8(255,153,102)
const Auburn = Color8(109,53,26)
const Azure = Color8(0,127,255)
const BabyBlue = Color8(137,207,240)
const BabyBlueEyes = Color8(161,202,241)
const BabyPink = Color8(244,194,194)
const BananaYellow = Color8(255,209,42)
const BattleshipGrey = Color8(132,132,130)
const Bazaar = Color8(152,119,123)
const Beige = Color8(245,245,220)
const Bistre = Color8(61,43,31)
const Black = Color8(0,0,0)
const BleuDeFrance = Color8(49,140,231)
const Blond = Color8(250,240,190)
const Blue = Color8(0,0,255)
const Blush = Color8(222,93,131)
const Bole = Color8(121,68,59)
const BostonUniversityRed = Color8(204,0,0)
const Brass = Color8(181,166,66)
const BrightGreen = Color8(102,255,0)
const BrightLavender = Color8(191,148,228)
const BrightMaroon = Color8(195,33,72)
const BrightPink = Color8(255,0,127)
const BrightTurquoise = Color8(8,232,222)
const BrightUbe = Color8(209,159,232)
const BritishRacingGreen = Color8(0,66,37)
const Bronze = Color8(205,127,50)
const Brown = Color8(150,75,0)
const BubbleGum = Color8(255,193,204)
const Bubbles = Color8(231,254,255)
const Buff = Color8(240,220,130)
const Burgundy = Color8(128,0,32)
const Burlywood = Color8(222,184,135)
const BurntOrange = Color8(204,85,0)
const BurntSienna = Color8(233,116,81)
const BurntUmber = Color8(138,51,36)
const Byzantine = Color8(189,51,164)
const Byzantium = Color8(112,41,99)
const Cadet = Color8(83,104,120)
const CadmiumGreen = Color8(0,107,60)
const CadmiumOrange = Color8(237,135,45)
const CadmiumRed = Color8(227,0,34)
const CambridgeBlue = Color8(163,193,173)
const CamouflageGreen = Color8(120,134,107)
const CanaryYellow = Color8(255,239,0)
const CandyAppleRed = Color8(255,8,0)
const Cardinal = Color8(196,30,58)
const CaribbeanGreen = Color8(0,204,153)
const Carmine = Color8(150,0,24)
const CarolinaBlue = Color8(153,186,221)
const CarrotOrange = Color8(237,145,33)
const Ceil = Color8(146,161,207)
const Celadon = Color8(172,225,175)
const Cerulean = Color8(0,123,167)
const CeruleanBlue = Color8(42,82,190)
const Chamoisee = Color8(160,120,90)
const Champagne = Color8(247,231,206)
const Charcoal = Color8(54,69,79)
const Chartreuse = Color8(223,255,0)
const Cherry = Color8(222,49,99)
const CherryBlossomPink = Color8(255,183,197)
const Chestnut = Color8(205,92,92)
const Chocolate = Color8(123,63,0)
const ChromeYellow = Color8(255,167,0)
const Cinereous = Color8(152,129,123)
const Cinnabar = Color8(227,66,52)
const Cinnamon = Color8(210,105,30)
const Citrine = Color8(228,208,10)
const ClassicRose = Color8(251,204,231)
const Clover = Color8(0,255,111)
const Cobalt = Color8(0,71,171)
const ColumbiaBlue = Color8(155,221,255)
const CoolBlack = Color8(0,46,99)
const CoolGrey = Color8(140,146,172)
const Copper = Color8(184,115,51)
const Coquelicot = Color8(255,56,0)
const Coral = Color8(255,127,80)
const Cordovan = Color8(137,63,69)
const Corn = Color8(251,236,93)
const CornellRed = Color8(179,27,27)
const CornflowerBlue = Color8(100,149,237)
const Cornsilk = Color8(255,248,220)
const Cream = Color8(255,253,208)
const Crimson = Color8(220,20,60)
const Cyan = Color8(0,255,255)
const Daffodil = Color8(255,255,49)
const Dandelion = Color8(240,225,48)
const DarkBlue = Color8(0,0,139)
const DarkBrown = Color8(101,67,33)
const DarkByzantium = Color8(93,57,84)
const DarkCandyAppleRed = Color8(164,0,0)
const DarkCerulean = Color8(8,69,126)
const DarkChestnut = Color8(152,105,96)
const DarkCoral = Color8(205,91,69)
const DarkCyan = Color8(0,139,139)
const DarkGoldenrod = Color8(184,134,11)
const DarkGreen = Color8(1,50,32)
const DarkJungleGreen = Color8(26,36,33)
const DarkKhaki = Color8(189,183,107)
const DarkLava = Color8(72,60,50)
const DarkLavender = Color8(115,79,150)
const DarkMagenta = Color8(139,0,139)
const DarkMidnightBlue = Color8(0,51,102)
const DarkOliveGreen = Color8(85,107,47)
const DarkOrange = Color8(255,140,0)
const DarkPastelBlue = Color8(119,158,203)
const DarkPastelGreen = Color8(3,192,60)
const DarkPastelPurple = Color8(150,111,214)
const DarkPastelRed = Color8(194,59,34)
const DarkPink = Color8(231,84,128)
const DarkPowderBlue = Color8(0,51,153)
const DarkRaspberry = Color8(135,38,87)
const DarkSalmon = Color8(233,150,122)
const DarkScarlet = Color8(86,3,25)
const DarkSienna = Color8(60,20,20)
const DarkSlateGray = Color8(47,79,79)
const DarkSpringGreen = Color8(23,114,69)
const DarkTan = Color8(145,129,81)
const DarkTangerine = Color8(255,168,18)
const DarkTerraCotta = Color8(204,78,92)
const DarkViolet = Color8(148,0,211)
const DavySGrey = Color8(85,85,85)
const Denim = Color8(21,96,189)
const Desert = Color8(193,154,107)
const DesertSand = Color8(237,201,175)
const DimGray = Color8(105,105,105)
const DollarBill = Color8(133,187,101)
const DukeBlue = Color8(0,0,156)
const EarthYellow = Color8(225,169,95)
const Eggplant = Color8(97,64,81)
const Emerald = Color8(80,200,120)
const Fawn = Color8(229,170,112)
const FerrariRed = Color8(255,28,0)
const FireEngineRed = Color8(206,22,32)
const Firebrick = Color8(178,34,34)
const Flame = Color8(226,88,34)
const FlamingoPink = Color8(252,142,172)
const Flavescent = Color8(247,233,142)
const ForestGreen = Color8(1,68,33)
const Gamboge = Color8(228,155,15)
const GhostWhite = Color8(248,248,255)
const Glaucous = Color8(96,130,182)
const GoldenBrown = Color8(153,101,21)
const GoldenYellow = Color8(255,223,0)
const Goldenrod = Color8(218,165,32)
const Gray = Color8(128,128,128)
const Green = Color8(0,128,0)
const Iceberg = Color8(113,166,210)
const Icterine = Color8(252,247,94)
const Inchworm = Color8(178,236,93)
const IndiaGreen = Color8(19,136,8)
const IndianRed = Color8(255,92,92)
const IndianYellow = Color8(227,168,87)
const InternationalKleinBlue = Color8(0,47,167)
const Ivory = Color8(255,255,240)
const Jade = Color8(0,168,107)
const Jasper = Color8(215,59,62)
const Khaki = Color8(195,176,145)
const Lavender = Color8(181,126,220)
const LavenderBlue = Color8(204,204,255)
const LavenderBlush = Color8(255,240,245)
const LavenderGray = Color8(196,195,208)
const LawnGreen = Color8(124,252,0)
const Lemon = Color8(255,247,0)
const Lime = Color8(191,255,0)
const Magenta = Color8(255,0,255)
const Mahogany = Color8(192,64,0)
const Maroon = Color8(128,0,0)
const MidnightBlue = Color8(25,25,112)
const Mint = Color8(62,180,137)
const Mustard = Color8(255,219,88)
const NavyBlue = Color8(0,0,128)
const Ochre = Color8(204,119,34)
const Olive = Color8(128,128,0)
const Orange = Color8(255,127,0)
const OxfordBlue = Color8(0,33,71)
const PastelBlue = Color8(174,198,207)
const PastelBrown = Color8(131,105,83)
const PastelGray = Color8(207,207,196)
const PastelGreen = Color8(119,221,119)
const PastelMagenta = Color8(244,154,194)
const PastelOrange = Color8(255,179,71)
const PastelPink = Color8(255,209,220)
const PastelPurple = Color8(179,158,181)
const PastelRed = Color8(255,105,97)
const PastelViolet = Color8(203,153,201)
const PastelYellow = Color8(253,253,150)
const Peach = Color8(255,229,180)
const Pear = Color8(209,226,49)
const Pearl = Color8(240,234,214)
const Peridot = Color8(230,226,0)
const PineGreen = Color8(1,121,111)
const Pink = Color8(255,192,203)
const Pistachio = Color8(147,197,114)
const Platinum = Color8(229,228,226)
const Plum = Color8(142,69,133)
const PortlandOrange = Color8(255,90,54)
const Prune = Color8(112,28,28)
const Pumpkin = Color8(255,117,24)
const PurpleHeart = Color8(105,53,156)
const Raspberry = Color8(227,11,93)
const RawUmber = Color8(130,102,68)
const Red = Color8(255,0,0)
const RifleGreen = Color8(65,72,51)
const Rosewood = Color8(101,0,11)
const RoyalBlue = Color8(0,35,102)
const Ruby = Color8(224,17,95)
const Rust = Color8(183,65,14)
const SafetyOrange = Color8(255,103,0)
const Saffron = Color8(244,196,48)
const Salmon = Color8(255,140,105)
const Sand = Color8(194,178,128)
const SandDune = Color8(150,113,23)
const Sandstorm = Color8(236,213,64)
const Sapphire = Color8(8,37,103)
const SealBrown = Color8(50,20,20)
const Seashell = Color8(255,245,238)
const Sepia = Color8(112,66,20)
const Shadow = Color8(138,121,93)
const Silver = Color8(192,192,192)
const Sinopia = Color8(203,65,11)
const SkyBlue = Color8(135,206,235)
const SkyMagenta = Color8(207,113,175)
const Snow = Color8(255,250,250)
const SpringBud = Color8(167,252,0)
const SteelBlue = Color8(70,130,180)
const Straw = Color8(228,217,111)
const Sunset = Color8(250,214,165)
const Tangerine = Color8(242,133,0)
const Teal = Color8(0,128,128)
const TerraCotta = Color8(226,114,91)
const TitaniumYellow = Color8(238,230,0)
const TropicalRainForest = Color8(0,117,94)
const Turquoise = Color8(48,213,200)
const Ultramarine = Color8(18,10,143)
const UnitedNationsBlue = Color8(91,146,229)
const Vanilla = Color8(243,229,171)
const Violet = Color8(143,0,255)
const Wheat = Color8(245,222,179)
const White = Color8(255,255,255)
const WhiteSmoke = Color8(245,245,245)
const Xanadu = Color8(115,134,120)
const YaleBlue = Color8(15,77,146)
const Yellow = Color8(255,255,0)

const IndianRed = Color8(205,92,92)
const LightCoral = Color8(240,128,128)
const Salmon = Color8(250,128,114)
const LightSalmon = Color8(255,160,122)
const DarkRed = Color8(139,0,0)
const LightPink = Color8(255,182,193)
const HotPink = Color8(255,105,180)
const DeepPink = Color8(255,20,147)
const MediumVioletRed = Color8(199,21,133)
const PaleVioletRed = Color8(219,112,147)
const Tomato = Color8(255,99,71)
const OrangeRed = Color8(255,69,0)
const Orange = Color8(255,165,0)
const Gold = Color8(255,215,0)
const LightYellow = Color8(255,255,224)
const LemonChiffon = Color8(255,250,205)
const LightGoldenrodYellow = Color8(250,250,210)
const PapayaWhip = Color8(255,239,213)
const Moccasin = Color8(255,228,181)
const PeachPuff = Color8(255,218,185)
const PaleGoldenrod = Color8(238,232,170)
const Khaki = Color8(240,230,140)
const Lavender = Color8(230,230,250)
const Thistle = Color8(216,191,216)
const Plum = Color8(221,160,221)
const Violet = Color8(238,130,238)
const Orchid = Color8(218,112,214)
const Fuchsia = Color8(255,0,255)
const MediumOrchid = Color8(186,85,211)
const MediumPurple = Color8(147,112,219)
const Amethyst = Color8(153,102,204)
const BlueViolet = Color8(138,43,226)
const DarkOrchid = Color8(153,50,204)
const Purple = Color8(128,0,128)
const Indigo = Color8(75,0,130)
const SlateBlue = Color8(106,90,205)
const DarkSlateBlue = Color8(72,61,139)
const MediumSlateBlue = Color8(123,104,238)
const GreenYellow = Color8(173,255,47)
const Chartreuse = Color8(127,255,0)
const Lime = Color8(0,255,0)
const LimeGreen = Color8(50,205,50)
const PaleGreen = Color8(152,251,152)
const LightGreen = Color8(144,238,144)
const MediumSpringGreen = Color8(0,250,154)
const SpringGreen = Color8(0,255,127)
const MediumSeaGreen = Color8(60,179,113)
const SeaGreen = Color8(46,139,87)
const ForestGreen = Color8(34,139,34)
const DarkGreen = Color8(0,100,0)
const YellowGreen = Color8(154,205,50)
const OliveDrab = Color8(107,142,35)
const MediumAquamarine = Color8(102,205,170)
const DarkSeaGreen = Color8(143,188,143)
const LightSeaGreen = Color8(32,178,170)
const Aqua = Color8(0,255,255)
const LightCyan = Color8(224,255,255)
const PaleTurquoise = Color8(175,238,238)
const Turquoise = Color8(64,224,208)
const MediumTurquoise = Color8(72,209,204)
const DarkTurquoise = Color8(0,206,209)
const CadetBlue = Color8(95,158,160)
const LightSteelBlue = Color8(176,196,222)
const PowderBlue = Color8(176,224,230)
const LightBlue = Color8(173,216,230)
const LightSkyBlue = Color8(135,206,250)
const DeepSkyBlue = Color8(0,191,255)
const DodgerBlue = Color8(30,144,255)
const RoyalBlue = Color8(65,105,225)
const MediumBlue = Color8(0,0,205)
const Navy = Color8(0,0,128)
const BlanchedAlmond = Color8(255,235,205)
const Bisque = Color8(255,228,196)
const NavajoWhite = Color8(255,222,173)
const Tan = Color8(210,180,140)
const RosyBrown = Color8(188,143,143)
const SandyBrown = Color8(244,164,96)
const Peru = Color8(205,133,63)
const Chocolate = Color8(210,105,30)
const SaddleBrown = Color8(139,69,19)
const Sienna = Color8(160,82,45)
const Brown = Color8(165,42,42)
const Honeydew = Color8(240,255,240)
const MintCream = Color8(245,255,250)
const Azure = Color8(240,255,255)
const OldLace = Color8(253,245,230)
const FloralWhite = Color8(255,250,240)
const AntiqueWhite = Color8(250,235,215)
const Linen = Color8(250,240,230)
const MistyRose = Color8(255,228,225)
const Gainsboro = Color8(220,220,220)
const LightGrey = Color8(211,211,211)
const DarkGray = Color8(169,169,169)
const LightSlateGray = Color8(119,136,153)
const SlateGray = Color8(112,128,144)

There you go, use it as a singleton image

Then you can do

Colors.Red

Then for each website I put this code in the console

http://www.workwithcolor.com/color-chart-full-01.htm

var colors = $$(".rgb-td, .n-td");
var str="";
for(var i = 4; i < colors.length; i+=4){
    str += `const ${colors[i+3].innerHTML.replace(/[\s'"]/g,'')} = Color8(${colors[i].innerHTML},${colors[i+1].innerHTML},${colors[i+2].innerHTML})\n`;
}

http://html-color-codes.info/color-names/

var colors = $$(".whitename, .white");
var str = ""; for(var i = 0; i < colors.length; i+=2){
    var c = colors[i+1].innerHTML;
    str+=`const ${colors[i].innerHTML.trim()} = Color8(${parseInt(c.substr(0,2),16)},${parseInt(c.substr(2,2),16)},${parseInt(c.substr(4,2),16)})\n`;
}

Then I use http://textmechanic.com/text-tools/basic-text-tools/remove-duplicate-lines/

to remove duplicate colors. I don't know how to use the asset lib, but I can figure it out and see if it can be put there.

SuperUserNameMan commented 8 years ago

Duno if it could be of any use, but I published this few days ago : https://github.com/SuperUserNameMan/color_to_name It has a color_to_name(color) and a name_to_color(name) funcs.

bojidar-bg commented 7 years ago

Is this still of interest of being in core?

thomasbaijot commented 7 years ago

I think yes. This is more user-friendly than rgb codes. And that's not a big thing to implement. 😊

Sslaxx commented 7 years ago

Looks good. Looking at rolling my own version combining the Color8 values in @LeonardMeagher2's version with the color_to_name/name_to_color of @SuperUserNameMan.

bojidar-bg commented 7 years ago

@thomasbaijot I'd say, it's questionable how big it was... Anyway, it's done for good.

thomasbaijot commented 7 years ago

Very nice, thx @bojidar-bg 😊