/    Sign up×
Community /Pin to ProfileBookmark

Hex Value of a Color

Hi there,

is there a way i can get the hex value of a color if a user types in the new background color. i.e. blue

then is it possible for me to get the hex value.

or alternately is there a way i can open a new window and have a color picker of sorts and allow them to change the color like that? and return the hex of the color they chose to my page?

Thnks

mdw…

to post a comment
JavaScript

10 Comments(s)

Copy linkTweet thisAlerts:
@KorJul 20.2004 — 
is there a way i can get the hex value of a color if a user types in the new background color. i.e. blue
[/quote]

But for any javascript method you may leave it as it is. [b]blue, red, green[/b] and all the basic colors are to be recognize as they are, even if string, by all the browsers. No need to hexa them (not to mention that Mozilla gets the style colors as RGB, not as hexa, even they are set as hexa, so if you don't need special colors, leave it so).


or alternately is there a way i can open a new window and have a color picker of sorts and allow them to change the color like that? and return the hex of the color they chose to my page?
[/quote]

Yes, of course, that can be done in javascript, but is not quite a simple coding... Google for and maybe you'll find something similar
Copy linkTweet thisAlerts:
@PittimannJul 20.2004 — Hi!

There are uncountable color pickers to be found in the www; if you are satisfied with a simple one, here is mine: http://www.pit-r.de/scripts/colorpicker/colPick.htm

Cheers - Pit
Copy linkTweet thisAlerts:
@JacksonCochraneJul 20.2004 — Try this:

<HTML>

<Head>

<Script Language=JavaScript>

function renderIt(n){

document.body.style.backgroundColor=n;
hexVal = document.body.style.backgroundColor;
alert("The hexVal is: "+hexVal);
}


</Script>

</Head>

<Body>

<center>

<h3>Changing a document's background color</h3>

<input type='radio' name='colors' onClick="renderIt('#7B68EE')">Medium Slate Blue<br>

<input type='radio' name='colors' onClick="renderIt('#FF6347')">Tomato<br>

<input type='radio' name='colors' checked onClick="renderIt('#FFFFFF')">White

</center>

</Body>

</HTML>
Copy linkTweet thisAlerts:
@KorJul 20.2004 — To JacksonCochrane:

As I said, but it looks like you have missed my note: try this in Mozilla and you wil have a BIIIIIGGGG surprise?

?
Copy linkTweet thisAlerts:
@JacksonCochraneJul 20.2004 — You, and Mozilla, are irrelvant. Meaningless trivialities.
Copy linkTweet thisAlerts:
@PittimannJul 20.2004 — Hi JacksonCochrane!You, and Mozilla, are irrelvant. Meaningless trivialities.[/QUOTE]If you put me into the same folder (concerning both Mozilla and Kor), it would be a great honor to me. Transferring a hex to a function as a parameter and receiving a hex from it - erm - that is not really what SniperX asked for. Where are the hex's here?[code=php]<HTML>
<Head>
<Script Language=JavaScript>
function renderIt(n){
document.body.style.backgroundColor=n;
hexVal = document.body.style.backgroundColor;
alert("The hexVal is: "+hexVal);
}
</Script>
</Head>
<Body>
<center>
<h3>Changing a document's background color</h3>
<input type='radio' name='colors' onClick="renderIt('blue')">blue<br>
<input type='radio' name='colors' onClick="renderIt('red')">red<br>
<input type='radio' name='colors' checked onClick="renderIt('white')">white
</center>
</Body>
</HTML>[/code]
Btw: are you related with that guy who made the first WARP flight and made these f...ing guys from Volcan land on our planet?

In deep irrelevance - Pit
Copy linkTweet thisAlerts:
@JacksonCochraneJul 20.2004 — Zephram Cochrane, the inventor of the warp drive, will be my great-great-great-great grandson. And despite all of his drinking, he takes after ME, he'll turn out alright. I have no animosity toward Vulcans or anyone else. I despise arrogance. I practice common courtesty, unless I'm confronted with arrogance.
Copy linkTweet thisAlerts:
@PittimannJul 20.2004 — ? Good luck to you and your future great-great-great-great grandson!

And good to know, you despise arrogance.

Ahay - Pit
Copy linkTweet thisAlerts:
@KorJul 21.2004 — Gee, great is the Lord's Holly Garden!... But what a pitty that a lot of dizzy peaple jump it's fence away...? ? ?
Copy linkTweet thisAlerts:
@PittimannJul 21.2004 — Hi!

You think the fence has to be made higher?

:p - Pit
×

Success!

Help @SniperX spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...