ColorOverride and other Colors
-
- Posts: 293
- Joined: Mon Apr 22, 2013 8:49 am
- Location: Dallas, TX
- Contact:
ColorOverride and other Colors
This is hopefully an easy question. I'm wondering how the numeric values for ColorOverride on appointments is generated. I think the same numbering system is used elsewhere, but I'd love to be able to generate those numbers without having to manually change something in the program then run a query to find that numeric value. I hope that makes sense.
Re: ColorOverride and other Colors
I'm assuming it will be a huge pain. You basically need to reverse engineer C#'s Color.ToArgb() which gets the 32-bit representation of a color (ARGB).
https://msdn.microsoft.com/en-us/librar ... .110).aspx
https://msdn.microsoft.com/en-us/librar ... .110).aspx
The best thing about a boolean is even if you are wrong, you are only off by a bit.
Jason Salmon
Open Dental Software
http://www.opendental.com
Jason Salmon
Open Dental Software
http://www.opendental.com
-
- Posts: 293
- Joined: Mon Apr 22, 2013 8:49 am
- Location: Dallas, TX
- Contact:
Re: ColorOverride and other Colors
That's acceptable. Mainly wanting to know how those values are generated. Thank you!jsalmon wrote:I'm assuming it will be a huge pain.
-
- Posts: 293
- Joined: Mon Apr 22, 2013 8:49 am
- Location: Dallas, TX
- Contact:
Re: ColorOverride and other Colors
Spent some time this afternoon and figured out the formula. Not sure it's that helpful, especially if people are writing plug-ins or apps in C#. But if you're not (like me), here's how the color value is calculated. It's a pretty simple formula based on the 256 possible values of each color of RGB:
( ((256-R)*256*256) - (256*G) - B ) * -1
Example:
R128, G255, B0 = -8323328
Walking through it:
128*256*256=8,388,608
256*255=65,280
8,388,608 - 65,280 = 8,323,328
Make it negative by multiplying it by -1.
( ((256-R)*256*256) - (256*G) - B ) * -1
Example:
R128, G255, B0 = -8323328
Walking through it:
128*256*256=8,388,608
256*255=65,280
8,388,608 - 65,280 = 8,323,328
Make it negative by multiplying it by -1.