Skip to content

Commit

Permalink
remove unused method and redundant comment
Browse files Browse the repository at this point in the history
  • Loading branch information
supersaiyansubtlety committed Aug 19, 2024
1 parent 864d647 commit 459b923
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.quiltmc.enigma.gui.config.theme;

import org.quiltmc.config.api.values.TrackedValue;
import org.quiltmc.enigma.gui.config.Config;
import org.quiltmc.enigma.gui.highlight.BoxHighlightPainter;
import org.quiltmc.enigma.gui.util.ScaleUtil;
Expand All @@ -9,46 +8,12 @@

import java.awt.Font;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.swing.JEditorPane;
import javax.swing.UIManager;

public final class ThemeUtil {
private ThemeUtil() { }

public static Map<String, Function<Theme.LookAndFeelColors, TrackedValue<Theme.SerializableColor>>>
createColorGettersByKey(
Stream<String> foregroundKeys,
Stream<String> backgroundKeys,

Stream<String> accentBaseColorKeys,

Stream<String> activeCaptionKeys,
Stream<String> inactiveCaptionKeys,

Stream<String> errorBorderKeys,
Stream<String> warningBorderKeys
) {
return Stream
.<Map.Entry<Stream<String>, Function<Theme.LookAndFeelColors, TrackedValue<Theme.SerializableColor>>>>
of(
Map.entry(foregroundKeys, Theme.LookAndFeelColors::getForeground),
Map.entry(backgroundKeys, Theme.LookAndFeelColors::getBackground),

Map.entry(accentBaseColorKeys, Theme.LookAndFeelColors::getAccentBaseColor),

Map.entry(activeCaptionKeys, Theme.LookAndFeelColors::getActiveCaption),
Map.entry(inactiveCaptionKeys, Theme.LookAndFeelColors::getInactiveCaption),

Map.entry(errorBorderKeys, Theme.LookAndFeelColors::getErrorBorder),
Map.entry(warningBorderKeys, Theme.LookAndFeelColors::getWarningBorder)
)
.flatMap(entry -> entry.getKey().map(key -> Map.entry(key, entry.getValue())))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}

// Calling this after the UI is initialized (e.g. when the user changes
// theme settings) is currently not functional.
public static void setupTheme() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ public static int invert(int i) {
public static void applyScaling() {
double scale = Config.main().scaleFactor.value();

// FlatLaf-based LaFs do their own scaling so we don't have to do it.
// Running swing-dpi for FlatLaf actually breaks fonts, so we let it scale the GUI.
if (Config.activeThemeProperties.needsScaling) {
UiDefaultsScaler.updateAndApplyGlobalScaling((int) (100 * scale), true);
}
Expand Down

0 comments on commit 459b923

Please sign in to comment.