| View previous topic :: View next topic |
| Author |
Message |
LinkSisco Valued Newbie
Joined: 17 May 2002 Posts: 30 Location: UK
|
Posted: Wed Jun 26, 2002 11:09 pm Post subject: Accessing windows colour wheel, and retriving hex colours. |
|
|
How can I do this, I have seen it done before but I cant find the source anymore.
Thank you. |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Wed Jun 26, 2002 11:29 pm Post subject: |
|
|
In vds 4, all you need to do is this:
| Code: |
option colordlg, hexonly
%%color = @colordlg()
|
Take care, _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
LinkSisco Valued Newbie
Joined: 17 May 2002 Posts: 30 Location: UK
|
Posted: Thu Jun 27, 2002 8:58 am Post subject: |
|
|
Thanks, but will that work in VDS3?
If not how would I do it with that?
Thanks. |
|
| Back to top |
|
 |
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
|
| Back to top |
|
 |
LinkSisco Valued Newbie
Joined: 17 May 2002 Posts: 30 Location: UK
|
Posted: Thu Jun 27, 2002 9:49 am Post subject: |
|
|
Thats great work Tommy, but how do I get the HEX values from the colours?
Thanks |
|
| Back to top |
|
 |
LinkSisco Valued Newbie
Joined: 17 May 2002 Posts: 30 Location: UK
|
Posted: Thu Jun 27, 2002 12:23 pm Post subject: |
|
|
Please anyone how can i get the hex code???
Thought i would also mention that I need it to be web safe hex code.
Thanks...
Last edited by LinkSisco on Thu Jun 27, 2002 12:30 pm; edited 1 time in total |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Thu Jun 27, 2002 12:27 pm Post subject: |
|
|
Here ya go. I think Tommy originally made this.
| Code: |
:Color Convert
if @equal(%%vds,red)
%%vds = $000000FF
else
if @equal(%%vds,black)
%%vds = $00000000
else
if @equal(%%vds,white)
%%vds = $00FFFFFF
else
if @equal(%%vds,dkred)
%%vds = $00000080
else
if @equal(%%vds,dkgreen)
%%vds = $00008000
else
if @equal(%%vds,brown)
%%vds = $00008080
else
if @equal(%%vds,dkblue)
%%vds = $00800000
else
if @equal(%%vds,magenta)
%%vds = $00800080
else
if @equal(%%vds,gray)
%%vds = $00808080
else
if @equal(%%vds,silver)
%%vds = $00C0C0C0
else
if @equal(%%vds,ltgreen)
%%vds = $0000FF00
else
if @equal(%%vds,yellow)
%%vds = $0000FFFF
else
if @equal(%%vds,ltblue)
%%vds = $00FF0000
else
if @equal(%%vds,cyan)
%%vds = $00FFFF00
end
end
end
end
end
end
end
end
end
end
end
end
end
end
%%vdscolor = @sum(%%vds,0)
%%hex = @hex(%%vdscolor,
%%blue = @sum($@substr(%%hex,3,4),0)
%%green = @sum($@substr(%%hex,5,6),0)
%%red = @sum($@substr(%%hex,7, ,0)
%%_1 = @hex(@diff(%%vds,0),
%%html = #@substr(%%_1,7, @substr(%%_1,5,6)@substr(%%_1,3,4)
info VDS color: %%vdscolor@cr()Hex color: %%hex@cr()Red: %%red@cr()Green: %%green@cr()Blue: %%blue @cr()HTML: %%HTML
exit
|
_________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
LinkSisco Valued Newbie
Joined: 17 May 2002 Posts: 30 Location: UK
|
Posted: Thu Jun 27, 2002 10:35 pm Post subject: |
|
|
Right i have been fighing thid all night and still i have not got the result i need.
Right says i have a button and lets say its called "button". When i click the button i need it to open the windows colour picker, after the user selects a colour and clicks ok, i need the program to take the colour and convert it to the 6 value hex number used on webpages.
What code would do this?
Thanks for any help... |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Jun 27, 2002 11:17 pm Post subject: |
|
|
VDS 3.x does not provide direct access to Windows' color picker, so you may have a problem doing that.
VDS 4.x does, as Liquidcode states, have support for this. Just use something like this:
| Code: | option colordlg, webonly
%%color = @colordlg()
info %%color |
It will output the color code used in HTML.
Greetz
Dr. Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
LinkSisco Valued Newbie
Joined: 17 May 2002 Posts: 30 Location: UK
|
Posted: Fri Jun 28, 2002 9:49 am Post subject: |
|
|
| How can I use Tommys dll to get the colour then covert it to a websafe hex code? |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
|
| Back to top |
|
 |
|