Colors (SOLVED)
Colors (SOLVED)
Hello friends!
I need a little help, I have a color in decimal (for example 6736896). How to get tones above or below, what's the logic?
Thanks
I need a little help, I have a color in decimal (for example 6736896). How to get tones above or below, what's the logic?
Thanks
Last edited by ctoas on Mon Jun 14, 2021 5:56 pm, edited 1 time in total.
Christiano Augusto Silveira
christiano.silveira@gmail.com
MaxxTech Soluções em TI
http://www.maxxtech.com.br
christiano.silveira@gmail.com
MaxxTech Soluções em TI
http://www.maxxtech.com.br
- Antonio Linares
- Site Admin
- Posts: 42485
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 28 times
- Been thanked: 66 times
- Contact:
Re: Colors
Christiano,
? hb_NumToHex( 6736896 ) => 0x66CC00 (hexadecimal)
? hb_NumToHex( hb_bitAnd( 6736896, 0xFF0000 ) / 0xFF00 )
? hb_NumToHex( hb_bitAnd( 6736896, 0x00FF00 ) / 0x00FF )
? hb_NumToHex( hb_bitAnd( 6736896, 0x0000FF ) )
In FWH\include\colors.ch there is a:
#translate RGB( <nRed>, <nGreen>, <nBlue> ) => ;
( <nRed> + ( <nGreen> * 256 ) + ( <nBlue> * 65536 ) )
? hb_NumToHex( 6736896 ) => 0x66CC00 (hexadecimal)
? hb_NumToHex( hb_bitAnd( 6736896, 0xFF0000 ) / 0xFF00 )
? hb_NumToHex( hb_bitAnd( 6736896, 0x00FF00 ) / 0x00FF )
? hb_NumToHex( hb_bitAnd( 6736896, 0x0000FF ) )
In FWH\include\colors.ch there is a:
#translate RGB( <nRed>, <nGreen>, <nBlue> ) => ;
( <nRed> + ( <nGreen> * 256 ) + ( <nBlue> * 65536 ) )
Re: Colors (SOLVED)
Thanks Antonio
Christiano Augusto Silveira
christiano.silveira@gmail.com
MaxxTech Soluções em TI
http://www.maxxtech.com.br
christiano.silveira@gmail.com
MaxxTech Soluções em TI
http://www.maxxtech.com.br
Re: Colors (SOLVED)
Hello,
about the color-adjustment of a given color
can be selected with the slider or a imageclick
Visual adjustment
A gradient created from < white . Your color. black >
This tool uses a given value as Dec or RGB
the startposition is 0.5 and can be adjusted to lighter or darker
6736896
![Image](http://www.service-fivewin.de/images/Coloradjust1.jpg)
is that what You want to do
regards
Uwe![Very Happy :D](./images/smilies/icon_biggrin.gif)
about the color-adjustment of a given color
can be selected with the slider or a imageclick
How to get tones above or below, what's the logic?
Visual adjustment
A gradient created from < white . Your color. black >
This tool uses a given value as Dec or RGB
the startposition is 0.5 and can be adjusted to lighter or darker
6736896
![Image](http://www.service-fivewin.de/images/Coloradjust1.jpg)
is that what You want to do
![Question :?:](./images/smilies/icon_question.gif)
regards
Uwe
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Last edited by ukoenig on Sat Dec 04, 2021 10:33 am, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: Colors (SOLVED)
Hi Uwe, thanks for replying.
I'm adjusting the visual part of my calendar, as the user can change the predominant color of the screen, the calendar has differences in the colors of today, Sundays and holidays. In the way I'm doing it, in some situations it's out of color.
So I want to calculate to get a few shades above or below the predominant color.
![Image](http://maxxtech.com.br/forum/calendario.jpg)
Hugs
I'm adjusting the visual part of my calendar, as the user can change the predominant color of the screen, the calendar has differences in the colors of today, Sundays and holidays. In the way I'm doing it, in some situations it's out of color.
So I want to calculate to get a few shades above or below the predominant color.
![Image](http://maxxtech.com.br/forum/calendario.jpg)
Hugs
Christiano Augusto Silveira
christiano.silveira@gmail.com
MaxxTech Soluções em TI
http://www.maxxtech.com.br
christiano.silveira@gmail.com
MaxxTech Soluções em TI
http://www.maxxtech.com.br
Re: Colors (SOLVED)
Maybe useful for You
paint colors from a given DEC or RGB-value
or use predefined colors
You can save and restore 4 colors
adjust the color with the slider or click inside the image
as well You get the colornames
the ??? buttons will paint the color and shows the values
![Image](http://www.service-fivewin.de/images/CAdjust1.jpg)
Download
http://www.service-fivewin.de/DOWNLOADS/CAdjust.zip
best regards
Uwe
paint colors from a given DEC or RGB-value
or use predefined colors
You can save and restore 4 colors
adjust the color with the slider or click inside the image
as well You get the colornames
the ??? buttons will paint the color and shows the values
![Image](http://www.service-fivewin.de/images/CAdjust1.jpg)
Download
http://www.service-fivewin.de/DOWNLOADS/CAdjust.zip
best regards
Uwe
Last edited by ukoenig on Tue Jun 22, 2021 11:23 am, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: Colors (SOLVED)
Hi.
I haven't touched it yet but that's almost what I need when using the slider but automatically, I think it would be more interesting in my case although I could do something similar and let the user choose the tone they prefer.
Would it be possible to share so you can have a beginning?
Hugs
I haven't touched it yet but that's almost what I need when using the slider but automatically, I think it would be more interesting in my case although I could do something similar and let the user choose the tone they prefer.
Would it be possible to share so you can have a beginning?
Hugs
Christiano Augusto Silveira
christiano.silveira@gmail.com
MaxxTech Soluções em TI
http://www.maxxtech.com.br
christiano.silveira@gmail.com
MaxxTech Soluções em TI
http://www.maxxtech.com.br
Re: Colors
Antonio Linares wrote:Christiano,
? hb_NumToHex( 6736896 ) => 0x66CC00 (hexadecimal)
? hb_NumToHex( hb_bitAnd( 6736896, 0xFF0000 ) / 0xFF00 )
? hb_NumToHex( hb_bitAnd( 6736896, 0x00FF00 ) / 0x00FF )
? hb_NumToHex( hb_bitAnd( 6736896, 0x0000FF ) )
I must disagree, the correct formulas are:
? hb_NumToHex( hb_bitAnd( 6736896, 0xFF0000 ) / 0x10000 )
? hb_NumToHex( hb_bitAnd( 6736896, 0x00FF00 ) / 0x100 )
? hb_NumToHex( hb_bitAnd( 6736896, 0x0000FF ) )
or better
? hb_NumToHex( hb_bitShift( hb_bitAnd( 6736896, 0xFF0000 ) ,-16) )
? hb_NumToHex( hb_bitShift( hb_bitAnd( 6736896, 0x00FF00 ) ,-8) )
? hb_NumToHex( hb_bitAnd( 6736896, 0x0000FF ) )
Re: Colors (SOLVED)
I added some new options
1, testing the color as a dialog-brush ( ON / OFF )
2. saving a color to INI pos. 1, this color is displayed at new start
3. copy to clipboard
4. some internal fixes
ctoas
what sections do You need ?
I can delete the unneeded parts for better reading.
[img]http:/CAdjust2.jpg[/img]
Download
http://www.service-fivewin.de/DOWNLOADS/CAdjus1t.zip
The extracted main-functions
now it is easy to include this color-adjustment in Your own application
![Image](http://www.service-fivewin.de/images/CAdjust3.jpg)
Download
http://www.service-fivewin.de/DOWNLOADS/CAdjus12.zip
best regards
Uwe
1, testing the color as a dialog-brush ( ON / OFF )
2. saving a color to INI pos. 1, this color is displayed at new start
3. copy to clipboard
4. some internal fixes
ctoas
what sections do You need ?
I can delete the unneeded parts for better reading.
[img]http:/CAdjust2.jpg[/img]
Download
http://www.service-fivewin.de/DOWNLOADS/CAdjus1t.zip
The extracted main-functions
now it is easy to include this color-adjustment in Your own application
![Image](http://www.service-fivewin.de/images/CAdjust3.jpg)
Download
http://www.service-fivewin.de/DOWNLOADS/CAdjus12.zip
best regards
Uwe
Last edited by ukoenig on Sat Mar 04, 2023 10:19 am, edited 4 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: Colors (SOLVED)
Hello Uwe, thanks for the reply.
It's already a good size for you to share. Now I turn around!
I appreciate the help!
It's already a good size for you to share. Now I turn around!
I appreciate the help!
Christiano Augusto Silveira
christiano.silveira@gmail.com
MaxxTech Soluções em TI
http://www.maxxtech.com.br
christiano.silveira@gmail.com
MaxxTech Soluções em TI
http://www.maxxtech.com.br
Re: Colors (SOLVED)
I tested and added a horizontal solution
a little colorpicker and control-fields of the pickpositions as a info
are included as well.
Because of the 2. slider it is posssible to compare 2 colorlevels
like the image shows ( bright and dark )
< Create > a new color will update both sliders and all fields
I think it will give You the basics to create Your own tool.
![Image](http://www.service-fivewin.de/images/CAdjust4.jpg)
Download
http://www.service-fivewin.de/DOWNLOADS/CAdjust3.zip
the needed calculations are included inside the prg
best regards
Uwe![Very Happy :D](./images/smilies/icon_biggrin.gif)
a little colorpicker and control-fields of the pickpositions as a info
are included as well.
Because of the 2. slider it is posssible to compare 2 colorlevels
like the image shows ( bright and dark )
< Create > a new color will update both sliders and all fields
I think it will give You the basics to create Your own tool.
![Image](http://www.service-fivewin.de/images/CAdjust4.jpg)
Download
http://www.service-fivewin.de/DOWNLOADS/CAdjust3.zip
the needed calculations are included inside the prg
Code: Select all | Expand
// calculation vertical
// ------------------------
// imageheight = 300
// sliderheight = 330
// slidertop = imagetop - 15
// slidermarks = 11 = 10 spaces
// slider-pixelrowpos = slider rowpos * 10
// sliderpos on imageclick = imagepixelpos / 300
// imagepos on sliderclick = sliderpos * 30
// image-columnpos = imagewidth / 2 = 25
// calculation horizontal
// --------------------------
// imagewidth = 340
// sliderwidth = 370
// sliderleft = imagejeft - 15
// slidermarks = 11 = 10 spaces
// slider-pixel-colpos = slider colpos * 10
// sliderpos on imageclick = imagepixelpos / 340
// imagepos on sliderclick = sliderpos * 34
// image-rowpos = imageheight / 2 = 22
best regards
Uwe
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.