|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2020-2022 - The MegaMek Team. All Rights Reserved. |
| 2 | + * Copyright (c) 2020-2024 - The MegaMek Team. All Rights Reserved. |
3 | 3 | *
|
4 | 4 | * This file is part of MekHQ.
|
5 | 5 | *
|
@@ -442,6 +442,65 @@ public Color getStratConHexCoordForeground() {
|
442 | 442 | public void setStratConHexCoordForeground(Color value) {
|
443 | 443 | userPreferences.node(MHQConstants.DISPLAY_NODE).putInt(MHQConstants.STRATCON_HEX_COORD_FOREGROUND, value.getRGB());
|
444 | 444 | }
|
| 445 | + |
| 446 | + public Color getFontColorNegative() { |
| 447 | + return new Color(userPreferences.node(MHQConstants.DISPLAY_NODE).getInt(MHQConstants.FONT_COLOR_NEGATIVE, Color.RED.getRGB())); |
| 448 | + } |
| 449 | + |
| 450 | + /** |
| 451 | + * @return the hexadecimal color code for the negative event font color. |
| 452 | + */ |
| 453 | + public String getFontColorNegativeHexColor() { |
| 454 | + return convertFontColorToHexColor(getFontColorNegative()); |
| 455 | + } |
| 456 | + |
| 457 | + public void setFontColorNegative(Color value) { |
| 458 | + userPreferences.node(MHQConstants.DISPLAY_NODE).putInt(MHQConstants.FONT_COLOR_NEGATIVE, value.getRGB()); |
| 459 | + } |
| 460 | + |
| 461 | + public Color getFontColorPositive() { |
| 462 | + return new Color(userPreferences.node(MHQConstants.DISPLAY_NODE).getInt(MHQConstants.FONT_COLOR_POSITIVE, Color.GREEN.getRGB())); |
| 463 | + } |
| 464 | + |
| 465 | + /** |
| 466 | + * @return the hexadecimal color code for the positive event font color. |
| 467 | + */ |
| 468 | + public String getFontColorPositiveHexColor() { |
| 469 | + return convertFontColorToHexColor(getFontColorPositive()); |
| 470 | + } |
| 471 | + |
| 472 | + public void setFontColorPositive(Color value) { |
| 473 | + userPreferences.node(MHQConstants.DISPLAY_NODE).putInt(MHQConstants.FONT_COLOR_POSITIVE, value.getRGB()); |
| 474 | + } |
| 475 | + |
| 476 | + public Color getFontColorWarning() { |
| 477 | + return new Color(userPreferences.node(MHQConstants.DISPLAY_NODE).getInt(MHQConstants.FONT_COLOR_WARNING, Color.ORANGE.getRGB())); |
| 478 | + } |
| 479 | + |
| 480 | + /** |
| 481 | + * @return the hexadecimal color code for the warning event font color. |
| 482 | + */ |
| 483 | + public String getFontColorWarningHexColor() { |
| 484 | + return convertFontColorToHexColor(getFontColorWarning()); |
| 485 | + } |
| 486 | + |
| 487 | + public void setFontColorWarning(Color value) { |
| 488 | + userPreferences.node(MHQConstants.DISPLAY_NODE).putInt(MHQConstants.FONT_COLOR_WARNING, value.getRGB()); |
| 489 | + } |
| 490 | + |
| 491 | + /** |
| 492 | + * Converts the font color to a hexadecimal color representation. |
| 493 | + * |
| 494 | + * @param color the font color to convert |
| 495 | + * @return the hexadecimal color representation of the font color |
| 496 | + */ |
| 497 | + public String convertFontColorToHexColor(Color color) { |
| 498 | + int red = color.getRed(); |
| 499 | + int green = color.getGreen(); |
| 500 | + int blue = color.getBlue(); |
| 501 | + |
| 502 | + return String.format("#%02x%02x%02x", red, green, blue); |
| 503 | + } |
445 | 504 | //endregion Colours
|
446 | 505 |
|
447 | 506 | //region Fonts
|
|
0 commit comments