Jump to content

Color: Difference between revisions

From LabVIEW Wiki
Fix layout
Add more details about System colors
Line 15: Line 15:
== System Color  ==
== System Color  ==


LabVIEW supports [http://blog.eyesonvis.com/2010/04/29/system-colors-dont-believe-your-eyes/ six system colors], they match on Windows different color types:
{{ambox|text=What are the system colors on Linux and macOS?}}
 
LabVIEW provides six system colors that change depending on the selected color theme of the Operating System<ref>[http://blog.eyesonvis.com/2010/04/29/system-colors-dont-believe-your-eyes/ System Colors - Don't Believe Your Eyes] (Eyes on VIs)</ref>:
 
[[File:ColorDropDownSystem.png]]


{| class="wikitable"
{| class="wikitable"
! colspan="3" | System color table
! colspan="2" | Name
! colspan="3" | Value
|-
|-
! LabVIEW color name
! LabVIEW
! Windows color name
! Windows<ref name="GetSysColor">[https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsyscolor GetSysColor()] (Microsoft Dev Center)</ref>
! LabVIEW color value
! LabVIEW
! colspan="2" | Windows<ref name="GetSysColor" />
|-
|-
| Panel and Object
| Panel & Object
| COLOR_3DFACE
| <code>COLOR_BTNFACE (15)</code>
| <code>0x01000016</code>
| <code>0x01000016</code>
| <code>0x00F0F0F0</code>
| <div style="display: block; background-color: #F0F0F0; padding: 10px;" />
|-
|-
| Panel and Object text
| Panel & Object Text
| COLOR_BTNTEXT
| <code>COLOR_BTNTEXT (18)</code>
| <code>0x01000006</code>
| <code>0x01000006</code>
| <code>0x00000000</code>
| <div style="display: block; background-color: #000000; padding: 10px;" />
|-
|-
| Window
| Window
| COLOR_WINDOW
| <code>COLOR_WINDOW (5)</code>
| <code>0x0100000A</code>
| <code>0x0100000A</code>
| <code>0x00FFFFFF</code>
| <div style="display: block; background-color: #FFFFFF; padding: 10px;" />
|-
|-
| Window text
| Window Text
| COLOR_WINDOWTEXT
| <code>COLOR_WINDOWTEXT (8)</code>
| <code>0x0100000C</code>
| <code>0x0100000C</code>
| <code>0x00000000</code>
| <div style="display: block; background-color: #000000; padding: 10px;" />
|-
|-
| Highlight
| Highlight
| COLOR_HIGHLIGHT
| <code>COLOR_HIGHLIGHT (13)</code>
| <code>0x01000008</code>
| <code>0x01000008</code>
| <code>0x000078D7</code>
| <div style="display: block; background-color: #0078D7; padding: 10px;" />
|-
|-
| Highlight text
| Highlight Text
| COLOR_HIGHLIGHTTEXT
| <code>COLOR_HIGHLIGHTTEXT (14)</code>
| <code>0x01000009</code>
| <code>0x01000009</code>
| <code>0x00FFFFFF</code>
| <div style="display: block; background-color: #FFFFFF; padding: 10px;" />
|}
|}


[[File:ColorDropDownSystem.png]]
There's a VI on ni.com that demonstrates all the LabVIEW system colors, which includes many more than can be selected from the color picker dialog: [http://zone.ni.com/devzone/cda/epd/p/id/4125]
 
=== Change system colors on Windows 10 ===
 
[[Wikipedia:Windows 10|Windows 10]] has no built-in dialog to change system colors<ref>[https://answers.microsoft.com/en-us/windows/forum/windows_10-start/can-i-enable-the-windows-classic-theme-in-windows/3fa6da8f-b319-4d13-aafb-05b79d85dc42 Can I enable the Windows classic theme in Windows 10?] (Microsoft Answers)</ref>. The color values, however, can still be modified directly in the [[Wikipedia:Windows Registry|Registry]] under <code>HKEY_CURRENT_USER\Control Panel\Colors</code> (requires reboot) or via SetSysColor<ref name="SetSysColor">[https://docs.microsoft.com/de-de/windows/win32/api/winuser/nf-winuser-setsyscolors SetSysColor()] (Microsoft Dev Center)</ref> (doesn't require reboot).


There's a VI on ni.com that demonstrates all the LabVIEW system colors, which includes many more than can be selected from the color picker dialog: [http://zone.ni.com/devzone/cda/epd/p/id/4125]
{|
| [[File:GetSysColor.png|frame|left|Reads a system color using GetSysColor<ref name="GetSysColor" />]]
|-
| [[File:SetSysColor.png|frame|left|Sets a system color using SetSysColor<ref name="SetSysColor" />]]
|}


== User colors  ==
== User colors  ==
Line 120: Line 146:


[[File:ColorAdjustUser.png]]
[[File:ColorAdjustUser.png]]
== References ==
<references/>


[[Category:Data types]]
[[Category:Data types]]

Revision as of 07:08, 16 November 2019

Colors are represented in LabVIEW by an unsigned 32-bit integer. The integer is of the hexadecimal form 0x00RRGGBB, where RR, GG, and BB represent the red, green, and blue components of the color, respectively.

Special cases

LabVIEW uses the upper byte (00) for special colors, normally this byte is used for transparency so using these color values in a different program might give odd results.

Transparent

Transparent has a color value 0x01000000 the last bit of the transparency byte is high, this can be used to create 'holes' controls:

System Background

This color turns the background into the background of the front-panel/block diagram. It's value is 0x01000037, special details: System_Label.

System Color

LabVIEW provides six system colors that change depending on the selected color theme of the Operating System[1]:

Name Value
LabVIEW Windows[2] LabVIEW Windows[2]
Panel & Object COLOR_BTNFACE (15) 0x01000016 0x00F0F0F0
Panel & Object Text COLOR_BTNTEXT (18) 0x01000006 0x00000000
Window COLOR_WINDOW (5) 0x0100000A 0x00FFFFFF
Window Text COLOR_WINDOWTEXT (8) 0x0100000C 0x00000000
Highlight COLOR_HIGHLIGHT (13) 0x01000008 0x000078D7
Highlight Text COLOR_HIGHLIGHTTEXT (14) 0x01000009 0x00FFFFFF

There's a VI on ni.com that demonstrates all the LabVIEW system colors, which includes many more than can be selected from the color picker dialog: [1]

Change system colors on Windows 10

Windows 10 has no built-in dialog to change system colors[3]. The color values, however, can still be modified directly in the Registry under HKEY_CURRENT_USER\Control Panel\Colors (requires reboot) or via SetSysColor[4] (doesn't require reboot).

Reads a system color using GetSysColor[2]
Sets a system color using SetSysColor[4]

User colors

LabVIEW has additional colors that are used for specific elements, like the tank fill color, here's an overview of these colors and their LabVIEW color value, these are not stored with a special value, the following lists the default values for these colors. LabVIEW defines 15 colors per default, but has support for 3 additional colors.

LabVIEW color table
Default LabVIEW color name Default LabVIEW color value
3D object 0x00BCBCBC
Control background 0x00FAFAFA
Indicator background 0x00D2D2D2
3D Active object 0x00969696
Text 0x00000000
Led On 0x0064FF00
Led Off 0x001E4B00
Thermometer Fill 0x00FF0000
Slide Fill 0x000041DC
Slide Housing 0x006D6D83
Tank Fill 0x000041DC
Tank Housing 0x00A9B3CB
Classic Object 0x00B3B3B3
Classic Slide Object 0x003399FF
Refnum Wire 0x00007F7F

These color's are stored in the LabVIEW configuration file with the token colorUserItem

Adjustment

To adjust (or add) colors use the LabVIEW options Dialog. In LabVIEW 2009 the colors can be set in the Environment section.

A special dialog is available for the 18 supported colors:

References