FormatTextAreaText Color Bug ?

BlitzMax Forums/MaxGUI Module/FormatTextAreaText Color Bug ?

danvari(Posted 2008) [#1]
hey!
i have got a problem concerning the latest blitzmax 1.30 and maxgui 1.30. i try to change the color of my textareatext, but it does not work with _every_ color. "default" colors like red, green and blue work fine, the rest is still black. here is an example:

Import MaxGui.Drivers

Local window:TGadget = CreateWindow("Test", 0, 0, 500, 500)
Local text:TGadget = CreateTextArea(0, 0, 490, 490, window)

SetTextAreaText text, "Test"

'FormatTextAreaText text, 255, 0, 0, Null		'this one works....red text color
FormatTextAreaText text, 250, 250, 100, Null		' -> black text color...why?

Repeat
	Select WaitEvent()
		Case EVENT_WINDOWCLOSE
			End
	End Select
Forever


i am using linux.


SebHoll(Posted 2008) [#2]
This appears as a really bright yellow on my PC, but it's because I'm on Vista. The problem is with the FLTK toolkit as opposed to MaxGUI. Are you using the latest SVN version of FLTKMaxGUI as the color contrast tolerance was widened in the last commit?

In case you haven't figured it out, it's because the FLTK toolkit is trying to be user-friendly by defaulting to either black or white (whichever has a higher contrast to the background) when the colour chosen is not considered different enough to make the text eligible. You are wanting a very bright yellow typeface on a white background which, perhaps some may agree, isn't too good on the eyes.




danvari(Posted 2008) [#3]
yes youre right, it isnt too good for my eyes, but i want yellow for example...how can i achieve it? no i am not using the latest svn... why can i choose which color i want if it not will be accepted by fltk? it makes no sense for me.
the latest svn build...does it fix this, so can i use every color i want or what has been changed?


Mark Tiffany(Posted 2008) [#4]
why can i choose which color i want if it not will be accepted by fltk?

Ask the people that wrote fltk? But it makes sense to me - the above colour combination is absurd.


danvari(Posted 2008) [#5]
yes, but for example in my app i have got a grey background. i want to use a yellow color for my text (for syntax highlighting, i am writing an editor), not that bright yellow, but still yellow. and yellow is a combination of R, G and B. how do i get to know which combination i have to use to get yellow font color to grey background? there are so many combinations and it seems to reject it every time to black.


SebHoll(Posted 2008) [#6]
does it fix this, so can i use every color i want or what has been changed?

I don't know whether it will fix this particular combination, but the contrast is determined in a file named Fl_Color.cxx in the src subfolder... It is possible to get FLTK to simply use the color specified, but I didn't think this was the best solution. Instead, I just widened the tolerance so that it allowed a larger range of colors. I can't guarantee that the combination you are using is going to be accepted, but there is a greater chance that it will with the latest SVN version of FLTKMaxGUI.

Plash was having a similar problem until the tweak was made as the colours he chose for syntax highlighting in the IDE were quite similar too. His color combination worked with after the tweak was committed:

See here for Plash's post.

If you do decide to use the SVN version of MaxGUI, you can find the repository info here:

The MaxGUI SVN Advice Thread


danvari(Posted 2008) [#7]
ok thank you i will try that when i am back home on sunday :).