Page 1 of 1
Colors (SOLVED)
Posted: Sun Jun 13, 2021 11:27 pm
by ctoas
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
Re: Colors
Posted: Mon Jun 14, 2021 7:09 am
by Antonio Linares
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 ) )
Re: Colors (SOLVED)
Posted: Mon Jun 14, 2021 5:56 pm
by ctoas
Thanks Antonio
Re: Colors (SOLVED)
Posted: Wed Jun 16, 2021 12:58 pm
by ukoenig
Hello,
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 adjustmentA 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)
Re: Colors (SOLVED)
Posted: Wed Jun 16, 2021 1:24 pm
by ctoas
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
Re: Colors (SOLVED)
Posted: Thu Jun 17, 2021 3:34 pm
by ukoenig
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.zipbest regards
Uwe
Re: Colors (SOLVED)
Posted: Thu Jun 17, 2021 3:53 pm
by ctoas
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
Re: Colors
Posted: Mon Jun 21, 2021 2:51 pm
by AntoninoP
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, 0x
FF0000 ) / 0x10000 )
? hb_NumToHex( hb_bitAnd( 6736896, 0x00
FF00 ) / 0x100 )
? hb_NumToHex( hb_bitAnd( 6736896, 0x0000
FF ) )
or better
? hb_NumToHex( hb_bitShift( hb_bitAnd( 6736896, 0x
FF0000 ) ,-16) )
? hb_NumToHex( hb_bitShift( hb_bitAnd( 6736896, 0x00
FF00 ) ,-8) )
? hb_NumToHex( hb_bitAnd( 6736896, 0x0000
FF ) )
Re: Colors (SOLVED)
Posted: Tue Jun 22, 2021 11:24 am
by ukoenig
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.zipThe extracted main-functionsnow 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.zipbest regards
Uwe
Re: Colors (SOLVED)
Posted: Wed Jun 23, 2021 6:19 pm
by ctoas
Hello Uwe, thanks for the reply.
It's already a good size for you to share. Now I turn around!
I appreciate the help!
Re: Colors (SOLVED)
Posted: Sat Jun 26, 2021 6:52 am
by ukoenig
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.zipthe 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)