(Color c)
| 495 | //custom color selector |
| 496 | colorMenu.add(new CustomColorSelector() { |
| 497 | @Override |
| 498 | public void onColorSelected(Color c) { |
| 499 | //compute all colors from the selected color |
| 500 | float[] hsb = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null); |
| 501 | hsb[1] *= 0.69f; //reduce saturation |
| 502 | if (hsb[2] < 0.55f) { |
| 503 | //if brightness<55%, use dark settings |
| 504 | Color internal = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2])), |
| 505 | external = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2] + 0.1f)), |
| 506 | bar = external, |
| 507 | buttons = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2] + 0.3f)), |
| 508 | lineBorder = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2] + 0.15f)), |
| 509 | text = new Color(255, 255, 255), |
| 510 | selectionBk = hsb[1] < 0.01f ? new Color(192, 192, 192) : new Color(Color.HSBtoRGB(hsb[0]-0.05f, hsb[1]+0.2f, 1f)), //if low saturation, use alternative selection color instead of computed one |
| 511 | selectedText = new Color(0, 0, 0); |
| 512 | Color[] customScheme = new Color[]{external, lineBorder, bar, buttons, internal, text, selectionBk, selectedText}; |
| 513 | setColorScheme(customScheme); |
| 514 | } else { |
| 515 | //otherwise, use bright settings |
| 516 | Color internal = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2])), |
| 517 | external = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2] - 0.04f)), |
| 518 | bar = external, |
| 519 | buttons = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2] - 0.35f)), |
| 520 | lineBorder = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2] - 0.1f)), |
| 521 | text = new Color(0, 0, 0), |
| 522 | selectionBk = hsb[1] < 0.01f ? new Color(72, 72, 72) : new Color(Color.HSBtoRGB(hsb[0], hsb[1]+0.2f, 0.4f)), //if low saturation, use alternative selection color instead of computed one |
| 523 | selectedText = new Color(255, 255, 255); |
| 524 | Color[] customScheme = new Color[]{external, lineBorder, bar, buttons, internal, text, selectionBk, selectedText}; |
| 525 | setColorScheme(customScheme); |
| 526 | } |
| 527 | colorMenu.setVisible(false); |
| 528 | Main.saveState(); |
| 529 | } |
| 530 | }); |
| 531 | colorMenu.add(new JPopupMenu.Separator()); |
| 532 | JMenuItem m = new JMenuItem(getLocString("ABOUT")); |
nothing calls this directly
no test coverage detected