Snippet stringColor

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
stringColor
Created by Darthfett

Description:
A list of hex color code globals.

The purpose of this library is to give you an idea of how to use string
constants and colors effectively in display text. It is not a complete list
and neither will it ever be. Instead, it is simply a list made to be added to.​

Requirements:
N/A​

The rest of the documentation can be found in the system code, below:

JASS:
library stringColor
/*
__________________________________________________________________________________

        stringColor library, created by Darthfett - version 1.2
        http://www.thehelper.net/forums/showthread.php?t=143593
            
                                Requirements
                                
-vJass compiler (such as JASSHelper)

                                Documentation
                                
-All globals are standalone.  Feel free to copy an individual global.

-Credit for this library is not necessary.  Feel free to use it in your map.
If you feel obligated to credit me, I won't object.  I only ask that you do 
not simply copy and paste the library as your own.

-The library isn't really needed. You can get by simply by copying and pasting
the globals block. You don't need to require the library
in order to use this either, but 'using' the library gives more logical errors
to the user if they do not have it in their map.

                                  Purpose

The purpose of this library is to give you an idea of how to use string 
constants and colors effectively in display text.  It is not a complete list
and neither will it ever be.  Instead, it is simply a list made to be added to.

                                    API

This library provides a few hex color strings to use to color displayed text.

constant string CLR_END = "|r"
    This string is used to end the color coded string.
    (Example: CLR_RED + "This is Red" +  CLR_END + ", and this is white.")
    
constant string CLR_LIGHTYELLOW ... CLR_DARKGRAY
    These strings are used to color text that will be displayed
    on the average WC3 background. They were chosen to be easier to read.
    (Example: call BJDebugMsg(CLR_Yellow + "Don't kill " + END + CLR_RED + "THAT!" + CLR_END)
    
constant string PC_RED ... PC_BROWN
    These strings are used to color something in a player's colored text.
    (Example: call BJDebugMsg(PC_RED + GetPlayerName(Player(0)) + CLR_END + ": HI gUyz!")

__________________________________________________________________________________
*/

globals
    constant string CLR_END =        "|r"
    
    //=========================
    constant string CLR_LIGHTYELLOW = "|cffffff00"
    constant string CLR_YELLOW =      "|cffffcc00"
    constant string CLR_GREEN =       "|cff00ff00"
    constant string CLR_BLUE =        "|cff0000ff"
    constant string CLR_RED =         "|cffff0000"
    constant string CLR_BROWN =       "|cffcc9933"
    constant string CLR_ORANGE =      "|cffff6400"
    constant string CLR_DARKGREEN =   "|cff009600"
    constant string CLR_AQUA =        CLR_DARKGREEN
    constant string CLR_DARKBLUE =    "|cff000096"
    constant string CLR_DARKRED =     "|cff960000"
    constant string CLR_DARKTEAL =    "|cff009696"
    constant string CLR_DARKCYAN =    CLR_DARKTEAL
    constant string CLR_DARKORANGE =  "|cffc86400"
    constant string CLR_DARKGRAY =    "|cff666666"
    
    constant string PC_RED       = "|cffff0303"
    constant string PC_BLUE      = "|cff0042ff"
    constant string PC_TEAL      = "|cff1ce6b9"
    constant string PC_PURPLE    = "|cff540081"
    constant string PC_YELLOW    = "|cfffffc01" 
    constant string PC_ORANGE    = "|cfffeba0e"
    constant string PC_GREEN     = "|cff20c000"
    constant string PC_PINK      = "|cffr55bb0"
    constant string PC_GRAY      = "|cff959697"
    constant string PC_LIGHTBLUE = "|cff7ebff1"
    constant string PC_DARKGREEN = "|cff107246"
    constant string PC_BROWN     = "|cff4e2a04"
    constant string PC_GREY      = PC_GRAY
    
    //=========================
endglobals

endlibrary


FAQ:
Q: Why use this library?
A: Simply put, the library gives some useful, standardized constants for concatenating strings.

Q: How do I get the color code for a specific player?
A: Since a player's color is not linked to a player's number in every map, player color and color codes are tracked in the stringPlayer library. You'll find the function you're looking for in that library.

Q: Why the unusual name?
A: Since the library is part of a collection of libraries (namely, the string library), I wanted the library names to stand out from others, and at the same time look unified.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
JASS:
library Colors initializer Init

globals
    constant string BLACK   = "|c00000000"
    constant string WHITE   = "|c00FFFFFF"    
	constant string GOLD    = "|c00FFCC00"
    constant string GREY    = "|c007d7d7d"  
    constant string DARKGREY= "|c00696969"

    constant string RED     = "|c00FF0000"
	constant string GREEN   = "|c0000FF00"
	constant string BLUE    = "|c000000FF"

    constant string YELLOW  = "|c00FFFF00"
    constant string ORANGE  = "|c00FF7F00"
    constant string PINK    = "|c00FF9696"
    constant string LIME    = "|c0096FF96"
    constant string MAGENTA = "|c00FF00FF"
    constant string NAVY    = "|c00000064"

    
    constant string  PC0   = "|c00FF0303"
    constant integer PC0_R = 255
    constant integer PC0_G = 3
    constant integer PC0_B = 3
    
    constant string  PC1   = "|c000042FF"    
    constant integer PC1_R = 0
    constant integer PC1_G = 66
    constant integer PC1_B = 255

    constant string  PC2   = "|c001CE6B9"    
    constant integer PC2_R = 28
    constant integer PC2_G = 230
    constant integer PC2_B = 185

    constant string  PC3   = "|c00540081"    
    constant integer PC3_R = 84
    constant integer PC3_G = 0
    constant integer PC3_B = 129

    constant string  PC4   = "|c00FFFC01"    
    constant integer PC4_R = 255
    constant integer PC4_G = 252
    constant integer PC4_B = 1
    
    constant string  PC5   = "|c00fEBA0E"    
    constant integer PC5_R = 254
    constant integer PC5_G = 186
    constant integer PC5_B = 14
    
    constant string  PC6   = "|c0020C000"    
    constant integer PC6_R = 32
    constant integer PC6_G = 192
    constant integer PC6_B = 0
    
    constant string  PC7   = "|c00E55BB0"    
    constant integer PC7_R = 229
    constant integer PC7_G = 91
    constant integer PC7_B = 176
    
    constant string  PC8   = "|c00959697"    
    constant integer PC8_R = 149
    constant integer PC8_G = 150
    constant integer PC8_B = 151
    
    constant string  PC9   = "|c007EBFF1"    
    constant integer PC9_R = 126
    constant integer PC9_G = 191
    constant integer PC9_B = 241
    
    constant string  PC10   = "|c00106246"    
    constant integer PC10_R = 16
    constant integer PC10_G = 92
    constant integer PC10_B = 70
    
    constant string  PC11   = "|c004E2A04"    
    constant integer PC11_R = 78
    constant integer PC11_G = 42
    constant integer PC11_B = 4
    
    string array PC
    integer array PC_R
    integer array PC_G
    integer array PC_B
endglobals

private function Init takes nothing returns nothing
    set PC[0]  = PC0
    set PC[1]  = PC1
    set PC[2]  = PC2
    set PC[3]  = PC3
    set PC[4]  = PC4
    set PC[5]  = PC5
    set PC[6]  = PC6
    set PC[7]  = PC7
    set PC[8]  = PC8
    set PC[9]  = PC9
    set PC[10] = PC10
    set PC[11] = PC11
    set PC[12] = "cerror"
    
    set PC_R[0]  = PC0_R
    set PC_R[1]  = PC1_R
    set PC_R[2]  = PC2_R
    set PC_R[3]  = PC3_R
    set PC_R[4]  = PC4_R
    set PC_R[5]  = PC5_R
    set PC_R[6]  = PC6_R
    set PC_R[7]  = PC7_R
    set PC_R[8]  = PC8_R
    set PC_R[9]  = PC9_R
    set PC_R[10] = PC10_R
    set PC_R[11] = PC11_R
    set PC_R[12] = -1
    
    set PC_G[0]  = PC0_G
    set PC_G[1]  = PC1_G
    set PC_G[2]  = PC2_G
    set PC_G[3]  = PC3_G
    set PC_G[4]  = PC4_G
    set PC_G[5]  = PC5_G
    set PC_G[6]  = PC6_G
    set PC_G[7]  = PC7_G
    set PC_G[8]  = PC8_G
    set PC_G[9]  = PC9_G
    set PC_G[10] = PC10_G
    set PC_G[11] = PC11_G
    set PC_G[12] = -1
    
    set PC_B[0]  = PC0_B
    set PC_B[1]  = PC1_B
    set PC_B[2]  = PC2_B
    set PC_B[3]  = PC3_B
    set PC_B[4]  = PC4_B
    set PC_B[5]  = PC5_B
    set PC_B[6]  = PC6_B
    set PC_B[7]  = PC7_B
    set PC_B[8]  = PC8_B
    set PC_B[9]  = PC9_B
    set PC_B[10] = PC10_B
    set PC_B[11] = PC11_B
    set PC_B[12] = -1    
endfunction

endlibrary


Cohadar's library can beat this.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Cohadar's library can beat this.

Darthfett said:
The purpose of this library is to give you an idea of how to use string
constants and colors effectively in display text. It is not a complete list
and neither will it ever be. Instead, it is simply a list made to be added to.

This system is made to give a few colors that actually show up against the dark backgrounds in Warcraft III (this is the reason that colors like navy, black, darkgr[a/e]y, etc are not listed).

If you want player color, you can see the stringPlayer system.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
I think every constant should be prefixed with COLOUR_ (or "COLOR_") - I don't see why someone wouldn't have a constant named "RED" referring to player 1...

I could argue that the people using "RED" to refer to a specific player should prefix theirs with "PLAYER_". :p

While I agree with you to a certain level, I don't think that something that will be used as often as this is (at least in my own maps) should require so many extra characters. Part of my idea behind putting together a library of constants was to shorten lines with text, so as to make them readable without having to scroll. Player(0) really does not need to be referred to by a variable, and while I agree that my system should play nice by not reserving common words, I felt that this was worth it.
 

SanKakU

Member
Reaction score
21
JASS:

library Colors initializer Init

globals
    constant string BLACK   = "|c00000000"
    constant string WHITE   = "|c00FFFFFF"    
	constant string GOLD    = "|c00FFCC00"
    constant string GREY    = "|c007d7d7d"  
    constant string DARKGREY= "|c00696969"

    constant string RED     = "|c00FF0000"
	constant string GREEN   = "|c0000FF00"
	constant string BLUE    = "|c000000FF"

    constant string YELLOW  = "|c00FFFF00"
    constant string ORANGE  = "|c00FF7F00"
    constant string PINK    = "|c00FF9696"
    constant string LIME    = "|c0096FF96"
    constant string MAGENTA = "|c00FF00FF"
    constant string NAVY    = "|c00000064"

    
    constant string  PC0   = "|c00FF0303"
    constant integer PC0_R = 255
    constant integer PC0_G = 3
    constant integer PC0_B = 3
    
    constant string  PC1   = "|c000042FF"    
    constant integer PC1_R = 0
    constant integer PC1_G = 66
    constant integer PC1_B = 255

    constant string  PC2   = "|c001CE6B9"    
    constant integer PC2_R = 28
    constant integer PC2_G = 230
    constant integer PC2_B = 185

    constant string  PC3   = "|c00540081"    
    constant integer PC3_R = 84
    constant integer PC3_G = 0
    constant integer PC3_B = 129

    constant string  PC4   = "|c00FFFC01"    
    constant integer PC4_R = 255
    constant integer PC4_G = 252
    constant integer PC4_B = 1
    
    constant string  PC5   = "|c00fEBA0E"    
    constant integer PC5_R = 254
    constant integer PC5_G = 186
    constant integer PC5_B = 14
    
    constant string  PC6   = "|c0020C000"    
    constant integer PC6_R = 32
    constant integer PC6_G = 192
    constant integer PC6_B = 0
    
    constant string  PC7   = "|c00E55BB0"    
    constant integer PC7_R = 229
    constant integer PC7_G = 91
    constant integer PC7_B = 176
    
    constant string  PC8   = "|c00959697"    
    constant integer PC8_R = 149
    constant integer PC8_G = 150
    constant integer PC8_B = 151
    
    constant string  PC9   = "|c007EBFF1"    
    constant integer PC9_R = 126
    constant integer PC9_G = 191
    constant integer PC9_B = 241
    
    constant string  PC10   = "|c00106246"    
    constant integer PC10_R = 16
    constant integer PC10_G = 92
    constant integer PC10_B = 70
    
    constant string  PC11   = "|c004E2A04"    
    constant integer PC11_R = 78
    constant integer PC11_G = 42
    constant integer PC11_B = 4
    
    string array PC
    integer array PC_R
    integer array PC_G
    integer array PC_B
endglobals

private function Init takes nothing returns nothing
    set PC[0]  = PC0
    set PC[1]  = PC1
    set PC[2]  = PC2
    set PC[3]  = PC3
    set PC[4]  = PC4
    set PC[5]  = PC5
    set PC[6]  = PC6
    set PC[7]  = PC7
    set PC[8]  = PC8
    set PC[9]  = PC9
    set PC[10] = PC10
    set PC[11] = PC11
    set PC[12] = "cerror"
    
    set PC_R[0]  = PC0_R
    set PC_R[1]  = PC1_R
    set PC_R[2]  = PC2_R
    set PC_R[3]  = PC3_R
    set PC_R[4]  = PC4_R
    set PC_R[5]  = PC5_R
    set PC_R[6]  = PC6_R
    set PC_R[7]  = PC7_R
    set PC_R[8]  = PC8_R
    set PC_R[9]  = PC9_R
    set PC_R[10] = PC10_R
    set PC_R[11] = PC11_R
    set PC_R[12] = -1
    
    set PC_G[0]  = PC0_G
    set PC_G[1]  = PC1_G
    set PC_G[2]  = PC2_G
    set PC_G[3]  = PC3_G
    set PC_G[4]  = PC4_G
    set PC_G[5]  = PC5_G
    set PC_G[6]  = PC6_G
    set PC_G[7]  = PC7_G
    set PC_G[8]  = PC8_G
    set PC_G[9]  = PC9_G
    set PC_G[10] = PC10_G
    set PC_G[11] = PC11_G
    set PC_G[12] = -1
    
    set PC_B[0]  = PC0_B
    set PC_B[1]  = PC1_B
    set PC_B[2]  = PC2_B
    set PC_B[3]  = PC3_B
    set PC_B[4]  = PC4_B
    set PC_B[5]  = PC5_B
    set PC_B[6]  = PC6_B
    set PC_B[7]  = PC7_B
    set PC_B[8]  = PC8_B
    set PC_B[9]  = PC9_B
    set PC_B[10] = PC10_B
    set PC_B[11] = PC11_B
    set PC_B[12] = -1    
endfunction

endlibrary


Cohadar's library can beat this.

i really don't undestand what cohadar's library is trying to accomplish...explanation?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top