Token styles define the style of the displayed font, the colors of the text, and the background color of the text. Styles are defined for applicable themes, which may be light or dark, based on user preferences.
A token style can be defined with multiple applicable themes, in which case the given text style will be applied when any of the theme is selected as current in the user IDE.
The styles and theme are stored as flags in the getStyle() property of the interface. The actual value is a
mix of STYLE_
and THEME_
constant flags.
The colors are stored in an integer, in the following packed format: 0xAARRGGBB
.
Where AA is alpha, RR is red, GG is green, and BB is blue, on a 0-255 scale.
The 0 (zero) color value is reserved as the default color. The IDE can choose an appropriate color for the given attribute. (See COLOR_UNSPECIFIED)
If an IDE doesn't support a given font style, it won't be applied to it.
public static final int | The unspecified color constant. |
public static final int | STYLE_BOLD = 1 Style flag constant for making the text bold. |
public static final int | STYLE_DEFAULT = 0 The default style for the text. |
public static final int | STYLE_ITALIC = 2 Style flag constant for making the text italic. |
public static final int | STYLE_MASK = 15 Style mask to isolate style related flags. |
public static final int | Style flag constant for making the text stroke through. |
public static final int | STYLE_UNDERLINE = 4 Style flag constant for making the text underlined. |
public static final int | THEME_DARK = 16 Style flag constant for making a style applicable for dark themes. |
public static final int | THEME_LIGHT = 32 Style flag constant for making a style applicable for light themes. |
public static final int | THEME_MASK = 48 Style mask to isolate theme related flags. |
public static int | argb( Creates a color value. |
public boolean | Checks if this token style is the same as the argument. |
public int | Gets the background color. |
public int | Gets the foreground color (the text color). |
public int | getStyle() Gets the style and theme flags for this style. |
public static int | getTheme( Gets the theme related flags from a style flag. |
public int | hashCode() Gets the has code of the token style. |
public static boolean | isDarkTheme( Checks if the argument style flag is applicable to dark theme. |
public static boolean | isLightTheme( Checks if the argument style flag is applicable to light theme. |
public static int | rgb( Creates a color value with full opacity (255 alpha). |
In an IDE it represents text without any artifacts.
Only the last byte of the arguments will be used.
Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation on non-null object references:
- It is reflexive: for any non-null reference value
x
,x.equals(x)
should returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
The equals
method for class Object
implements the most discriminating possible equivalence
relation on objects; that is, for any non-null reference values x
and y
, this method returns
true
if and only if x
and y
refer to the same object (x == y
has the value
true
).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden,
so as to maintain the general contract for the hashCode
method, which states that equal objects must have
equal hash codes.
true
if this object is the same as the obj argument; false
otherwise.The result may be 0, if no theme is specified in the argument style.
backgroundColor * 31 + foregroundColor * 31 + style * 31Returns a hash code value for the object.This method is supported for the benefit of hash tables such as those provided by HashMap.
The general contract of hashCode
is:
- Whenever it is invoked on the same object more than once during an execution of a Java application, the
hashCode
method must consistently return the same integer, provided no information used inequals
comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. - If two objects are equal according to the
equals(Object)
method, then calling thehashCode
method on each of the two objects must produce the same integer result. - It is not required that if two objects are unequal according to the
equals(
Object) method, then calling thehashCode
method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by class Object
does return distinct
integers for distinct objects. (This is typically implemented by converting the internal address of the object
into an integer, but this implementation technique is not required by the Java™ programming language.)
true
if it contains THEME_DARK.true
if it contains THEME_LIGHT.Only the last byte of the arguments will be used.