Color (@NotNull String name) { Object value = UIManager.get("*"); if (value instanceof Map<?, ?> map) { @SuppressWarnings({"unchecked", "rawtypes"}) Map<String, Color> cache = (Map)UIManager.get("*cache"); if (cache != null && cache.containsKey(name)) { Color cached = cache.get(name); return cached == CACHED_NULL ? null : cached; } Color color = null; for (Map.Entry<?, ?> entry : map.entrySet()) { if (entry.getKey() instanceof String && name.endsWith((String)entry.getKey())) { Object result = map.get(entry.getKey()); if (result instanceof Color) { color = (Color)result; break; } } } if (cache != null) { cache.put(name, color == null ? CACHED_NULL : color); } return color; } return null; }