[Library] Colors

tooltiperror

Super Moderator
Reaction score
231
JASS:

//~~ Colors ~~ By Tyrulan ~~ Version 1.1.0 ~~
//
// The following code should be pretty self explanatory. 
// The functions would be used as follows:
// Color_RED("Hello World!")
// Color_BLUE("Hello World!")
// etc.
//
// OR
//
// Clr_RED("Hello World!")
// Clr_BLUE("Hello World!")
// etc.


Reading helps.
 

Tyrulan

Ultra Cool Member
Reaction score
37
Copy the snippet into a new trigger. Call it what you like.

The Colors.txt has instructions within as to where it goes. (If you're usng TESH Highlighting).

Then you're ready to go.

In the midst of any trigger you may call the color functions like so:

JASS:

call BJDebugMsg(Color_RED("Hello!"))   
call BJDebugMsg(Color_BLUE("Hello!"))
call BJDebugMsg(Color_TEAL("Hello!"))
call BJDebugMsg(Color_HINT("Hello!"))
call BJDebugMsg(Color_GRAY("Hello World!"))
call BJDebugMsg(Clr_RED("Hi"))
 

Tyrulan

Ultra Cool Member
Reaction score
37
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Bump
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Can this get approval?
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
This already exists.
No point to approve a library with same functionality.
Try to add some extra features.
 

SanKakU

Member
Reaction score
21
Added the Clr call. Is the original function still necessary?

well, i think that guy was just being silly. i'll just delete that function. people will rename the function whatever they want, anyway if they don't like color. i dislike clr because it looks like clear... in dos /clr did a clear screen.

i really don't understand what the tesh file does. you didn't explain it. does it write over the tesh colors?
does it just color the strings in the tesh that use the library? i don't get what it does. i'm afraid to use it...
 

Tyrulan

Ultra Cool Member
Reaction score
37
i really don't understand what the tesh file does. you didn't explain it. does it write over the tesh colors?

TESH Highlighting is just part of the compiler and syntax checker which allows the IntelliSense to recognize keywords. In this case it will prompt you when you begin typing "Col..." with a list of functions starting with those letters. (Like the natives built into a common.j file. I'm running NewGen WE 1.5d with the tesh syntax checker built in.

This already exists.
No point to approve a library with same functionality.
Try to add some extra features.

King, you keep referencing other libraries that have similar functionality. On this one, you mentioned the Cohander's (spelling?) can beat it, as you did with mine. As I've mentioned before I wanted to rid the user of typing COLOR_RED ... s ... COLOR_END by providing a simple API. This is not meant to be a "Player Colours" library but rather some simple functions calls to return coloured text.

If you intend for me to add more features into the library, I would willingly do so, if only I were told what people would like to see. Hence asking for comments and suggestions when this was originally posted. At this point I am looking for constructive criticism, not for someone to say "yours isn't good enough."
 

SanKakU

Member
Reaction score
21
TESH Highlighting is just part of the compiler and syntax checker which allows the IntelliSense to recognize keywords. In this case it will prompt you when you begin typing "Col..." with a list of functions starting with those letters. (Like the natives built into a common.j file. I'm running NewGen WE 1.5d with the tesh syntax checker built in.

OH....i thought it was part of the tesh colorizer...so it's part of the tesh function recognition? whoa! that sounds really useful! how come i haven't heard of this before?
edit: tried it, maybe because it doesn't work...did you tell us correctly what folder to put it in?
'jngpmainfolder\tesh\includes\', right?
 

Tyrulan

Ultra Cool Member
Reaction score
37
Heh, no idea. :) TimerUtils and other systems come with the .j file as well!
 

SanKakU

Member
Reaction score
21
the tesh version number. i was trying to figure out if your version is newer than mine, because the instructions you gave didn't work for enabling function autocomplete for custom map made functions.
 

Tyrulan

Ultra Cool Member
Reaction score
37
I am on 0.7. You may need to restart your editor for it to recompile it's included files.
 

SanKakU

Member
Reaction score
21
yeah, it's totally not working. it doesn't matter that much, i guess.

anyway, i thought of posting my rendition of your code, i hope you don't mind. i don't mean to steal your thunder or anything, i couldn't have done this without you, the other color stuff that i saw so far honestly wasn't as good as what you put up, at least not as far as i knew...but i also knew that what you posted was needing improvement. and lol at the suggestion to change color to clr. :eek:

anyway. here's my code, and instead of a library, it's a snippet. it's meant to be placed in the main map library.

JASS:

constant string C_goldbrown="|cffdaa520"
constant string C_gold="|cffffd700"
constant string C_palegreen="|cff7aff7c"
constant string C_pretty="|cffee82ee"
constant string C_grassgreen="|cff7fff00"
constant string C_brightgreen="|cff00ff00"
constant string C_brightblue="|cff0000ff"
constant string C_aqua="|cff00ffff"
constant string C_white="|cfff0ffff"
constant string C_seagreen="|cff7fffd4"
constant string C_twilightblur="|cff20b2aa"
constant string C_twilightgreen="|cff009966"
constant string C_coralgreen="|cff00fa9a"
constant string C_coralpink="|cfff08080"
constant string C_coralblue="|cff33aaff"
constant string C_plum="|cffba55d3"
constant string C_indigo="|cff4169e1"
constant string C_brightpurple="|cffff00ff"
constant string C_flowerred="|cffee2222"
constant string C_flowerpurple="|cffaaaaff"
constant string C_green="|cff32cd32"
constant string C_blue="|cff4169e1"
constant string C_yellowgreen="|cffadff2f"
constant string C_paledenim="|cffc3dbff"
constant string C_orange="|cffffa500"
constant string C_purple="|cffda70d6"  
constant string C_royalpurple="|cffaa00ff"                              
constant string C_grey="|cffc0c0c0"
constant string C_gray="|cffc0c0c0"
constant string C_redorange="|cffff4500"
constant string C_red="|cffff0000"
constant string C_spanishgreen="|cff9acd32"
constant string C_darkspanishgreen="|cff6b8e23"
constant string C_brown ="|cff995500"
constant string C_yellow="|cffffff00"
constant string C_sand="|cffffffcc"
constant string C_CLOSE ="|r" 
endglobals
//! textmacro givetextcolor takes TYPEWORD
function gtc_$TYPEWORD$ takes string s returns string
return C_$TYPEWORD$ + s + C_CLOSE
endfunction
//! endtextmacro
//! runtextmacro givetextcolor("goldbrown")
//! runtextmacro givetextcolor("gold")
//! runtextmacro givetextcolor("palegreen")
//! runtextmacro givetextcolor("pretty")
//! runtextmacro givetextcolor("grassgreen")
//! runtextmacro givetextcolor("brightgreen")
//! runtextmacro givetextcolor("aqua")
//! runtextmacro givetextcolor("brightblue")
//! runtextmacro givetextcolor("white")
//! runtextmacro givetextcolor("seagreen")
//! runtextmacro givetextcolor("twilightblur")
//! runtextmacro givetextcolor("twilightgreen")
//! runtextmacro givetextcolor("coralgreen")
//! runtextmacro givetextcolor("coralpink")
//! runtextmacro givetextcolor("coralblue")
//! runtextmacro givetextcolor("plum")
//! runtextmacro givetextcolor("indigo")
//! runtextmacro givetextcolor("brightpurple")
//! runtextmacro givetextcolor("flowerred")
//! runtextmacro givetextcolor("flowerpurple")
//! runtextmacro givetextcolor("green")
//! runtextmacro givetextcolor("blue")
//! runtextmacro givetextcolor("yellowgreen")
//! runtextmacro givetextcolor("paledenim")
//! runtextmacro givetextcolor("orange")
//! runtextmacro givetextcolor("purple")
//! runtextmacro givetextcolor("royalpurple")
//! runtextmacro givetextcolor("grey")
//! runtextmacro givetextcolor("gray")
//! runtextmacro givetextcolor("redorange")
//! runtextmacro givetextcolor("red")
//! runtextmacro givetextcolor("spanishgreen")
//! runtextmacro givetextcolor("darkspanishgreen")
//! runtextmacro givetextcolor("brown")
//! runtextmacro givetextcolor("yellow")
//! runtextmacro givetextcolor("sand")


what do you think, pretty cool, huh?
i guess i could add on more stuff if i wanted, but this should be good for starters. i thought gtc_ was much more intuitive than clr_ or Color_ gtc meaning give text color. but that's just me, maybe.
 

Tyrulan

Ultra Cool Member
Reaction score
37
That's fine. My snippet as you call it was only to suggest a method to add colour to text. If you would like to add/change my code that's up to you, just put my name in the credits! ;)

Keep in mind I've been re-vamping my code and it will soon surpass what I've posted.
 

SanKakU

Member
Reaction score
21
You mean indent? :p

Also - I feel some of the colour names are too long and would be cumbersome to type out.

yeah, i know what you mean. i just left them spelled that way in full so that you couldn't spell them wrong. after all, there is no forgiving tesh prompter that is working, although your library idea supposes there is one.

at any rate, people can take out the vowels(or shorten it elsewise) if they want, much like what was suggested earlier for your code, changing something like color into clr.

and i wasn't really planning on releasing the snippet...it's really up to you if you wanted to adopt my colors or not and update the original post with those. it's just a suggestion from me, for your resource. i know it's not my resource. ;)
Sankaku, can you even Intendent? :cool:

of course i can. i just prefer not to. code looks much better without whitespace(indentation), and is easier to edit and read, and also it's easier to type.
edit: i'll just put this in my map's code:
/*give text color snippet
concept by Tyrulan*/
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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