Dealing with 'color 7' - white.

Started by mr nick, March 13, 2009, 12:10:18 AM

Previous topic - Next topic

mr nick

I have a dialog which contains a textbox which previews a piece of text as it will appear on screen - the background of the box is set to show either the MS or PS background colour, the text shows in the selected layer colour and also the font of the selected style. The problem is that if you have a layer which uses colour 7 white and the PS background is white then the text is invisible. Also, if your MS background is the default true colour cream job, white text is also illegible. When AutoCAD displays 'white' it toggles between black and white depending on the background colour - is there a method of getting ODCL to replicate this behaviour? Making a bunch of IF conditions would be long-winded but feasible if you were restrained to 255 colours but with the introduction of true colour backgrounds this approach becomes pretty much impossible.

Fred Tomke

Hello,

I'm sure, you can query, if the textcolor should be 7. In this case you create a cond-condition with 3 cases:

- if ps is white, then use a black RGB color just for the preview
- if ms is white, then use a white RGB color just for the preview
- any other case: use the color

On my colour cream ms black is black and white is white anyway.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

mr nick

I really don't think three conditions would get this working. If a user has any form of 'darker' background i.e. browns or blues then colour 7 would display as white but if they use 'light' colours i.e yellows and pinks then colour 7 displays as black. As I said, with 255 colours then you could set up conditions but when using the true colours there are so many variations available it would be an incredibly long list of conditions.

Fred Tomke

I don't know any function of getting inverse colors. In my experiences AutoCAD does it itself when updating the viewport. i.e. draw a 3dsolid (_solid) and polyline with constantwidth > 0. Stretch a polyline's grip over the solid. The polyline has a different color partially.

It would be quite interesting to get known the "inverse" color.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

I'll bet you could convert both colors to an OLEColor via (dcl_GetOLEColorValue) and perform some arithmetic on the resulting RGB value to come up with a way to determine how much contrast there is between two colors, then change one of the colors accordingly.
Owen Wengerd (Outside The Box) / ManuSoft