Unstoppable Domains

HEX colors - Get same color a bit paler?

Spaceship Spaceship
Watch

PoorDoggie

Soon to be RICHdoggie!VIP Member
Impact
18
Hi. Is there any way to take a hex code color, and then get the same color a bit paler?

IE: If I had #000000, it may output #c0c0c0

Is there any way of doing that?

Thanks
Tom
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
You can do it with RGB colors.
Code:
<script type="text/javascript">
function cutHex(h) { return (h.charAt(0)=="#") ? h.substring(1,7) : h}
function toR(h) {return parseInt((cutHex(h)).substring(0,2),16)}
function toG(h) {return parseInt((cutHex(h)).substring(2,4),16)}
function toB(h) {return parseInt((cutHex(h)).substring(4,6),16)}
function hex(h) {document.getElementById('rgb').value = 'rgb('+toR(h)+','+toG(h)+','+toB(h)+')'}
</script>

<input type="text" onkeyup="hex(this.value);"> <input type="text" id="rgb">
Use that to get your colors into RGB. [I set it up to give you the RGB in CSS form..]

Then when you have the RGB, you can just add the same number to each one to make it lighter.
 
1
•••
you are amazing, thank you!!! :D
 
0
•••
-removed-
 
Last edited:
0
•••
Appraise.net

We're social

Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back