X
104 Rate this article:
No rating

INTERNAL: How do I easily switch background color to white and foreground color to black

Anonym
Topic:
Some folks want to reverse their fore and background colorsDiscussion:
Basically you want to change the system variables (!P.BACKGROUND and !P.COLOR) to some color table value between 0 and 255. Be careful modifying the system variables because they will not re-set later in your application if you need to use them. What I would do would be to make copies of both system vars before changing their color values and then setting the sys vars back to their orig. setting after you've made your plot, or whatever. Try this:

    IDL> device, decompose = 0    ;tell true color device to use color tables
    IDL> bg_color = !P.BACKGROUND
    IDL> fg_color = !P.COLOR
    IDL> !P.BACKGROUND = 255    ; WHITE
    IDL> !P.COLOR = 0    ; BLACK
    IDL> plot, findgen(100)
    IDL> !P.BACKGROUND = bg_color
    IDL> !P.COLOR = fg_color

Hope this produces the results you're after. Please let me know one way or the other so I can either help you further, or close out our transaction. Thanks!Solution:
[Edit this field in the IDL-based Tech Tip Editor, v3]