[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUDs
. -> [Folder]  General
. . -> [Subject]  Color Codes...

Color Codes...

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by CyrusMonroe   USA  (17 posts)  [Biography] bio
Date Wed 09 Nov 2016 02:28 PM (UTC)
Message
Ok... here is something, Been wanting to add more colors to the stock base of what I have... it is a Dystopia Code Base, which is Godwars, and which is Merc etc...

Anyways, been trying to look on the web, and other places for snippets, or such, to try and add MORE colors to my codebase, and the stock Pink, Cyan, Blue Red etc...
Yes I know you can add pictures in here as a post thingy so here are the links of what I am talking about.
My Stock Colors:
http://oi63.tinypic.com/wl62yt.jpg

Colors I want:
http://oi67.tinypic.com/k6qyq.jpg

I also want BLACK as well... Both background and foreground. Not all people use the Background as black I am finding out yes it is standard as a norm, but I have found some dont use it.

I just dont know where to actually find where to get a simple list of all of them that I can add.

If anyone needs the Dystopia codebase please give me a holler, as I see it is not available anywhere anymore.
I do have all the stock of all of them. If anyone wants to see/use them anyways.

If there are any questions, by all means ask away.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Thu 10 Nov 2016 08:53 PM (UTC)
Message
See the thread below about 256-colour ANSI support:


http://www.gammon.com.au/forum/bbshowpost.php?id=7761

On about page 3 are some colour swatches.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by CyrusMonroe   USA  (17 posts)  [Biography] bio
Date Reply #2 on Fri 11 Nov 2016 09:45 PM (UTC)
Message
Great on the color swatches... that does help for the colors problem is where to implement them, and how to get them to show via the color codes and the characters that need to show them IE: The #'s I just need to know where in my code where I set each color and such...
I am sorry about that, I am an idiot, Please forgive me, I didn't make myself clear.
Although the Swatches did help in narrowing down the color I needed and wanted... just don't know how to implement them to get them working.
Got the defines in, but cant figure out how to get the # tied to the Color I want....And actually putting the colors in them self. Cause I know I need to add the RGB Values but I cannot seem to find them at all in the code I looked in all my .h and .c files (though they should only be in .h I would figure than a .c's)
That is why I was hoping for a snippet or something somewhere to see how they did it even it if it for 1 color or 3 colors to see how they implemented it
I just blatantly cannot find it... unless I am totally over looking something that I am just missing out of left field....Yeh I used all the references that I could to make myself look odd and totally stupid.

But Thank you still for the dang swatches period... I still needed those Cause I wouldn't be able to even think of colors to use, and the subtle differences between them... you did an awesome job.

Oh...Here is something which I didn't know.
They already had black... lol... it is #8 as the Color number Right after Grey the 'dark' version is black... found that out by accident actually as I went #1-9 to see all the color codes... but it cant show cause it matched the background heh... funny.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Fri 11 Nov 2016 10:00 PM (UTC)

Amended on Fri 11 Nov 2016 10:01 PM (UTC) by Nick Gammon

Message
I'm not sure what you are asking. To show the colours just embed the ANSI codes in the output. For example:


ESC[38;5;Nm


Where N is the colour in the range 0 to 255. ESC is hex 0x1B.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by CyrusMonroe   USA  (17 posts)  [Biography] bio
Date Reply #4 on Fri 11 Nov 2016 10:25 PM (UTC)

Amended on Fri 11 Nov 2016 11:39 PM (UTC) by Nick Gammon

Message
This is my normal color palette... Labeled accordingly.

#define GREY		"ESC[0;1;30m"	/* Dark Grey #0*/
#define D_RED		"ESC[0;0;31m"	/* Dark Red */
#define L_RED		"ESC[0;1;31m"	/* Red #1 */
#define D_GREEN		"ESC[0;0;32m"	/* Dark Green */
#define L_GREEN		"ESC[0;1;32m"	/* Green #2 */
#define BROWN		"ESC[0;0;33m"	/* Brown / Gold*/
#define YELLOW		"ESC[0;1;33m"	/* Yellow #3 */
#define D_BLUE		"ESC[0;0;34m"	/* Dark Blue */
#define L_BLUE		"ESC[0;1;34m"	/* Blue #4  */
#define MAGENTA		"ESC[0;0;35m"	/* Magenta/Purple */
#define PINK		"ESC[0;1;35m"	/* Pink #5 */
#define D_CYAN		"ESC[0;0;36m"	/* Dark Cyan */
#define L_CYAN		"ESC[0;1;36m"	/* Cyan #6 */
#define NORMAL		"ESC[0;0;37m"	/* Grey #9 */
#define WHITE		"ESC[0;0;38m"	/* White #7*/



Now I did add For my Back Ground Colors vis your post which helped...these are the BG colors:

#define BGBLACK		"ESC[0;0;40m"	/* Black Background by Cyrus */
#define BGD_GREY	"ESC[0;1;40m"	/* Dark Grey Background by Cyrus*/
#define BGD_RED		"ESC[0;0;41m"	/* Dark Red Background by Cyrus*/
#define BGRED		"ESC[0;1;41m"	/* Red Background by Cyrus*/
#define BGGREEN		"ESC[0;0;42m"	/* Dark Green Background by Cyrus*/
#define BGD_GREEN	"ESC[0;1;42m"	/* Green Background by Cyrus */
#define BGYELLOW	"ESC[0;0;43m"	/* Yellow Background by Cyrus*/
#define BGBROWN		"ESC[0;1;43m"	/* Brown/Gold Background by Cyrus*/
#define BGBLUE		"ESC[0;0;44m"	/* Blue Background by Cyrus*/
#define BGL_BLUE	"ESC[0;1;44m"	/* Light Blue Background by Cyrus*/
#define BGMAGENTA	"ESC[0;0;45m"	/* Magenta Background by Cyrus*/
#define BGPINK		"ESC[0;1;45m"	/* Pink Background by Cyrus */
#define BGD_CYAN	"ESC[0;0;46m"	/* Dark Cyan Background by Cyrus*/
#define BGCYAN		"ESC[0;1;46m"	/* Cyan Background by Cyrus*/
#define BGGREY		"ESC[0;0;47m"	/* Grey Background by Cyrus Think Normal Color*/
#define BGWHITE		"ESC[0;1;47m"	/* White Background by Cyrus*/

// These are For the New Foreground Colors that I want...
// Need to change to color match what is out there... and need to add more
// As Well.
/*
#define AZURE           "ESC[0;0;30m"	// Azure by Cyrus
#define JADE		"ESC[0;1;30m"	// Jade 
#define LIME		"ESC[0;0;31m"	// Lime 
#define ORANGE		"ESC[0;1;31m"	// Orange  
#define L_MAGENTA	"ESC[0;0;32m"	// Light Magenta
#define TAN		"ESC[0;1;32m"	// Tan  
#define VIOLET		"ESC[0;0;33m"	// Violet 
#define D_PINK		"ESC[0;1;33m"	// Dark Pink  
#define D_AZURE		"ESC[0;0;34m"	// Dark Azure 
#define D_JADE		"ESC[0;1;34m"	// Dark Jade
#define D_LIME		"ESC[0;0;35m"	// Dark Lime 
#define D_ORANGE	"ESC[0;1;35m"	// Dark Orange  
#define D_TAN		"ESC[0;0;36m"	// Dark Tan 
#define D_VIOLET	"ESC[0;1;36m"	// Dark Violet  
*/



Which Went in fine for the mud in general... didnt crash...no errors no warnings...

But even so...From what I understand from what you did give me This is How the background would go anyways, unless I am misunderstanding that. But.

Even so, How does one access the colors in general? Cause the !@#$%^&*() keys barring # for the top ones... and #A-#Z other than the Normal ones from the pic, dont work either.

Lets say ^G Should should Background of Green Right? But Where if anything is in the code, that assigns the ^ to be a color code start I know there is word for it i just cant remember brain fart there. Like the # is for the First ones?

Dont mind in that 2nd part of the colors for the Azure, and Jade etc... I just didn't add the colors to the end They arent in yet as you can see they are commented out....but the BackGround colors are anyways. Or Should be according to what you did give me before... unless Iam looking at it all wrong.

I did get what you were saying, about the Where N is the color in the range 0 to 255. ESC is hex 0x1B. But i dont think mine handles it like that.... Well Not totally official anyways not like this... I wish it did! Unless I really am Missing something somewhere else, but I did look for anything even similar or remotely close to what the merc.h has period in anyway and I just cant seem to find it.


ESC[38;5;Nm


Sadly The Hex or even the RGB value anywhere I cannot find period, if it is even in there anyways.... I know something has to be somewhere... more thank likely called something else that I have no clue what, knowing my luck anyways.... but something has to be to even be read somehow buy clients of all sorts, yours, zmud, gmud cmud(what ever they want to call themselves nowadays *rolls eyes*).

I am just at a loss period.

(Hopefully I did all the formatting correctly)
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Fri 11 Nov 2016 11:43 PM (UTC)

Amended on Fri 11 Nov 2016 11:45 PM (UTC) by Nick Gammon

Message
I'm missing something here. For example:


#define BGBLACK		"ESC[0;0;40m"	/* Black Background by Cyrus */


You don't literally send ESC you send 0x1B which would look like:


#define BGBLACK		"\x1B[0;0;40m"	/* Black Background by Cyrus */


You also don't seem to be using the 256-ANSI colours at all.

Colour 125 from the table on the other page would be:


#define WHATEVER "\x1B[38;5;125m"

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by CyrusMonroe   USA  (17 posts)  [Biography] bio
Date Reply #6 on Sat 12 Nov 2016 01:15 AM (UTC)
Message

#define NO_COLOUR	""		/* Blank */
#define BLACK           ""	/* Black by Cyrus #8*/ 
#define GREY		""	/* Dark Grey #0*/
#define D_RED		""	/* Dark Red */
#define L_RED		""	/* Red #1 */
#define D_GREEN		""	/* Dark Green */
#define L_GREEN		""	/* Green #2 */
#define BROWN		""	/* Brown / Gold*/
#define YELLOW		""	/* Yellow #3 */
#define D_BLUE		""	/* Dark Blue */
#define L_BLUE		""	/* Blue #4  */
#define MAGENTA		""	/* Magenta/Purple */
#define PINK		""	/* Pink #5 */
#define D_CYAN		""	/* Dark Cyan */
#define L_CYAN		""	/* Cyan #6 */
#define NORMAL		""	/* Grey #9 */
#define WHITE		""	/* White #7*/
/*
#define AZURE           ""	// Azure by Cyrus
#define JADE		""	// Jade 
#define LIME		""	// Lime 
#define ORANGE		""	// Orange  
#define L_MAGENTA	""	// Light Magenta
#define TAN		""	// Tan  
#define VIOLET		""	// Violet 
#define D_PINK		""	// Dark Pink  
#define D_AZURE		""	// Dark Azure 
#define D_JADE		""	// Dark Jade
#define D_LIME		""	// Dark Lime 
#define D_ORANGE	""	// Dark Orange  
#define D_TAN		""	// Dark Tan 
#define D_VIOLET	""	// Dark Violet  
*/

#define BGBLACK		""	/* Black Background by Cyrus*/
#define BGD_GREY	""	/* Dark Grey Background by Cyrus*/
#define BGD_RED		""	/* Dark Red Background by Cyrus*/
#define BGRED		""	/* Red Background by Cyrus*/
#define BGGREEN		""	/* Dark Green Background by Cyrus*/
#define BGD_GREEN	""	/* Green Background by Cyrus */
#define BGYELLOW	""	/* Yellow Background by Cyrus*/
#define BGBROWN		""	/* Brown/Gold Background by Cyrus*/
#define BGBLUE		""	/* Blue Background by Cyrus*/
#define BGL_BLUE	""	/* Light Blue Background by Cyrus*/
#define BGMAGENTA	""	/* Magenta Background by Cyrus */
#define BGPINK		""	/* Pink Background by Cyrus */
#define BGD_CYAN	""	/* Dark Cyan Background by Cyrus */
#define BGCYAN		""	/* Cyan Background by Cyrus*/
#define BGGREY		""	/* Grey Background by Cyrus Think Normal Color*/
#define BGWHITE		""	/* White Background by Cyrus*/

#define ADD_COLOUR(_player,_str,_col)                       \
{                                                           \
	char swh_temp[255]; 				                    \
	if (!IS_NPC(_player) && IS_SET(_player->act, PLR_ANSI)) \
	{                                                       \
	swh_temp[0] = '\0';                                     \
	strcpy(swh_temp, _col);                                 \
	strcat(swh_temp, _str);                                 \
	strcat(swh_temp, NORMAL);                               \
	strcpy(_str, swh_temp);                                 \
	}                                                       \
}                                                           \

#define SCALE_COLS 4

#define COL_SCALE(_swh_str,_swh_ch,_swh_curr,_swh_max)      \
	ADD_COLOUR(_swh_ch, _swh_str,                           \
	(_swh_curr < 1) ? L_RED :                               \
	(_swh_curr < _swh_max) ?                                \
	scale[(SCALE_COLS * _swh_curr) / ((_swh_max > 0)        \
	? _swh_max : 1)] : L_CYAN)

extern char *scale[SCALE_COLS];


The Little backspace arrows are just what was copied and pasted as is... \x1B is converted to ESC automatically just by the Editor is all. :)
i put in the ESC before cause oddly it actually does show ESC in the editor.
As you can see...
This shows, the ESC as it is seen in NotePad++
http://oi65.tinypic.com/21otw8x.jpg

Well this From what I can see is the whole code for the color anywhere in the whole codebase.
255 from what I can see as well, is the temp colors to temp be put into the buffer for them to be altered for the screen... meaning to set them light dark etc how ever the above sees them to be added per structure of what is being used at that given time.

Although I did use

#define L_CYAN		""	/* Cyan #6 */

Just to see ... and it turned it into a Magenta.... or a DARK Purple almost like the #p does for the ones above in those picutre.

Did 210m
Got somewhere in between gold and magenta? Almost Pinky... LIke well just like the 210 is on your color charts oddly enough... Using the #6 or #C for the Cyan color code..(for testing purposes)
I just Need to or would like to figure out the # is in the code... So I can assign the # to what I need so which #'s so I can use them as new colors.
I think the 210 kinda well says I do have 256 right ;)
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #7 on Sat 12 Nov 2016 05:25 AM (UTC)

Amended on Sat 12 Nov 2016 05:32 AM (UTC) by Fiendish

Message
Quote:
#define GREY "ESC[0;1;30m" /* Dark Grey #0*/
#define D_RED "ESC[0;0;31m" /* Dark Red */
#define L_RED "ESC[0;1;31m" /* Red #1 */
#define D_GREEN "ESC[0;0;32m" /* Dark Green */
#define L_GREEN "ESC[0;1;32m" /* Green #2 */
...

First, your ansi codes are longer than necessary.
0;0;
is equivalent to just
0;

Second, your desired light and dark yellows are reversed.


Quote:
Lets say ^G Should should Background of Green Right? But Where if anything is in the code, that assigns the ^ to be a color code start I know there is word for it i just cant remember brain fart there. Like the # is for the First ones?

How should we know? I haven't seen you put a link anywhere to the codebase.

Quote:
If anyone needs the Dystopia codebase please give me a holler, as I see it is not available anywhere anymore.
Yes, of course we need to see it.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by CyrusMonroe   USA  (17 posts)  [Biography] bio
Date Reply #8 on Sun 13 Nov 2016 01:14 AM (UTC)
Message
To use a phrase from a wise 'ol master...
"it isn't my code, that's how I found it"

Lets put it into context.
I understand Nick's explanation on the color handling. How the color code works, how it is seen/called, now that I have used his color codes... which was awesome Nick btw... so thank you...that did help out alot actually.

Now the problem is....
The Mud uses # hastags for the younger people, or Pound signs for little older generation , or really old like me number sign.
So the #P Will Put up a bright Pink Color(or what they consider pink anyways form the first picture) its Called magenta really by them in the help file but Pink in the code go figure
Now what I am asking is where is the # located in the code? I looked for the character set, or the hex, or the ascii portion of the numbers throughout the code and I couldn't find the # to reference the # to have it be the trigger to color anything.
How is the #P know it is going to be Magenta at all?
Where does the link between, # to call the start of a new color, and P(or any color Letter or Number) reside?
Cause I just cant add the color like I did above as you saw, and just make it work it has to be able to be called somehow so it can be called by a person in the game.
I looked at or searched for Example PINK anywhere in the Code yes it found referenced to color things that are there like Items and what not but nothing that references how.
SO in Adding
Lets say:
(Keep in Mind the '' is an 'ESC' as you see in the Picture it just copies/pastes differently.)

#define AZURE   "" 

Now it wouldn't be a #A cause #A isn't referenced to
Azure where would it be to turn on?


#define D_AZURE "" 

If this is the Dark Azure, I cant do #D or #DA cause it doesn't work like that...
Where is the reference in the code cause I couldn't find it... where it would say
Something like

#define D_AZURE  a
or Not being exact here at all or even accurate...
if (IS_COLOR_AZURE == "") colorletter = "A";

Something that tells the Color Azure that tells the game or person to use the Cap Letter A in using the Color azure, and small a later on for Dark Azure.

Was trying to find the # reference to start calling the colors, but I couldn't even find that in the code.
So I can start possibly adding background colors as well... which is also what I wanted to do too.
But Since I cannot find the initial # to add a ^ which is a good point to use for the call sign of the BG colors, both were a non start from that point on.

Here is the Stock Codebase that I am using Nick....
Dont know if it will help you at all. I know you dont code or anything like that, I remember way back when you said that... but maybe it will help you in understanding what I see and what I am asking.
http://www.mediafire.com/file/02atmfxa2ivcn1j/dystopia-gold.tar.gz

Hope this Helps Nick.
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #9 on Sun 13 Nov 2016 04:35 AM (UTC)

Amended on Sun 13 Nov 2016 04:40 AM (UTC) by Fiendish

Message
CyrusMonroe said:
Lets put it into context.

Not necessary. I've already read the thread and I understand your question, because you've already asked your question. You just didn't provide the codebase until now.

Quote:
Where does the link between, # to call the start of a new color, and P(or any color Letter or Number) reside?

Start at line 1914 in src/comm.c

Quote:
Cause I just cant add the color like I did above as you saw

Those #defines are never used, which is why you aren't finding them. See the code I mention above and you'll find how to actually do it.


--- less important angry ranting at you ---

Quote:
...blah blah blah...

It's actually a lot easier to answer questions that are concise instead of rambling. It was paragraphs and paragraphs of me going "Yes, I know. Yes, I KNOW. YES, I KNOW. I KNOW THAT ALREADY! YOU ALREADY SAID THAT! SHUT UP AND GET TO THE PART WHERE YOU LINK THE SOURCE CODE! AHHHHHHH"

Quote:
Here is the Stock Codebase that I am using Nick....

I'm not Nick. I'm Fiendish.

Quote:

Dont know if it will help you at all. I know you dont code or anything like that

Hahahahahahahahahahaha. Nick has been coding since before you were born.

Quote:
http://www.mediafire.com/file/02atmfxa2ivcn1j/dystopia-gold.tar.gz

Next time you have a question, provide that link first instead of saying "If anyone needs the Dystopia codebase please give me a holler, as I see it is not available anywhere anymore."
How are we supposed to help you look at it until you share it with us? Right? Right.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Mon 14 Nov 2016 09:09 PM (UTC)
Message
Quote:

Now what I am asking is where is the # located in the code? I looked for the character set, or the hex, or the ascii portion of the numbers throughout the code and I couldn't find the # to reference the # to have it be the trigger to color anything.

How is the #P know it is going to be Magenta at all?


I don't understand the question, sorry.

Quote:

How does one access the colors in general? Cause the !@#$%^&*() keys barring # for the top ones... and #A-#Z other than the Normal ones from the pic, dont work either.


I don't understand what you are asking here.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #11 on Tue 15 Nov 2016 12:17 AM (UTC)
Message
Nick Gammon said:

Quote:

Now what I am asking is where is the # located in the code? I looked for the character set, or the hex, or the ascii portion of the numbers throughout the code and I couldn't find the # to reference the # to have it be the trigger to color anything.

How is the #P know it is going to be Magenta at all?


I don't understand the question, sorry.

Quote:

How does one access the colors in general? Cause the !@#$%^&*() keys barring # for the top ones... and #A-#Z other than the Normal ones from the pic, dont work either.


I don't understand what you are asking here.

Don't worry. I've answered it already.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


27,179 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]