Open mieubrisse opened 3 years ago
Extra things I've tried:
Removing the setTheme
on my Window object
graphics.putString(0, 0, itemString, style.getSGRs());
graphics.putCSIStyledString(0, 0, itemString);
Swapping the order of applyTheme
and putString
Add .setTerminalEmulatorColorConfiguration(TerminalEmulatorColorConfiguration.getDefault())
to my terminal factory
Set terminal emulator color config to TerminalEmulatorColorConfiguration.newInstance(TerminalEmulatorPalette.MAC_OS_X_TERMINAL_APP)
(thinking maybe colors were turned off)
terminal.setBackgroundColor(TextColor.ANSI.BLUE_BRIGHT);
Making a new theme and directly setting my item to it:
var clownTheme = SimpleTheme.makeTheme(
true,
TextColor.ANSI.WHITE,
TextColor.ANSI.BLUE,
TextColor.ANSI.WHITE,
TextColor.ANSI.MAGENTA,
TextColor.ANSI.WHITE,
TextColor.ANSI.CYAN,
TextColor.ANSI.GREEN);
.....
item1.setTheme(clownTheme);
Drop putString
and make absolutely sure that I'm writing a colored character:
graphics.setCharacter(
0,
0,
TextCharacter.fromCharacter('x', TextColor.ANSI.BLACK, TextColor.ANSI.BLUE)[0]
);
No luck yet
Check out the Checkbox.java
and the renderer at the end. You first grab the Theme definition from the component (which is coming from the global theme or whatever has been overridden):
ThemeDefinition themeDefinition = component.getThemeDefinition();
Then you'll need to activate a theme style on the graphics
to setup the colors/styles for the subsequent drawing operations. Here's how the checkbox chooses a different visual style depending on if the checkbox currently has input focus or not:
if(component.isFocused()) {
graphics.applyThemeStyle(themeDefinition.getActive());
}
else {
graphics.applyThemeStyle(themeDefinition.getNormal());
}
There are 5 standard styles and any number of custom styles that can be defined, but you'll have to check the theme definition property file to see exactly what they are setup as. After the graphics object has activated the style, the next operations will be using those colors:
graphics.fill(' ');
graphics.putString(4, 0, component.label);
Hope that helps.
...actually, there seems to be a theme issue in the latest build. That might be what you're seeing. I'm investigating.
It was a typo, I've fixed it and will release a new version.
3.1.1 released
The Theme API is quite neat and self-directing, but it doesn't have usage docs. It took a bit of digging to find
DefaultTheme
, and then I was confused why it was package-private it until I foundLanternaThemes.getDefault()
. After that, I'm getting a strange issue in myInteractableRenderer
where the following code:Prints out:
But the item sits as white-on-black:
It would be very helpful to have docs on the proper way to use this, in case I'm doing something dumb.