diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 1dd04c3..568b3c1 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -5,6 +5,8 @@ Changed
-------
* Flipping an image now happens on mouse press instead of mouse release
+* About dialog points to new website beeref.org
+* Menus and dialogs now have a dark style to match the optics of the canvas
Fixed
-----
diff --git a/README.rst b/README.rst
index b38b72c..be98dd0 100644
--- a/README.rst
+++ b/README.rst
@@ -5,7 +5,7 @@ BeeRef — A Simple Reference Image Viewer
-`BeeRef `_ lets you quickly arrange your reference images and view them while you create. Its minimal interface is designed not to get in the way of your creative process.
+`BeeRef `_ lets you quickly arrange your reference images and view them while you create. Its minimal interface is designed not to get in the way of your creative process.
|python-version| |github-ci-flake8| |github-ci-pytest| |codecov|
diff --git a/beeref/__main__.py b/beeref/__main__.py
index 6de727c..c648426 100755
--- a/beeref/__main__.py
+++ b/beeref/__main__.py
@@ -21,9 +21,10 @@ import sys
from PyQt6 import QtCore, QtWidgets
+from beeref import constants
from beeref.assets import BeeAssets
from beeref.config import CommandlineArgs, BeeSettings, logfile_name
-from beeref import constants
+from beeref.utils import create_palette_from_dict
from beeref.view import BeeGraphicsView
logger = logging.getLogger(__name__)
@@ -79,6 +80,8 @@ def main():
logger.info(f'Logging to: {logfile_name()}')
CommandlineArgs(with_check=True) # Force checking
app = QtWidgets.QApplication(sys.argv)
+ palette = create_palette_from_dict(constants.COLORS)
+ app.setPalette(palette)
bee = BeeRefMainWindow(app) # NOQA:F841
diff --git a/beeref/constants.py b/beeref/constants.py
index 208c444..d985061 100644
--- a/beeref/constants.py
+++ b/beeref/constants.py
@@ -16,5 +16,24 @@
APPNAME = 'BeeRef'
APPNAME_FULL = f'{APPNAME} Reference Image Viewer'
VERSION = '0.1.1'
-WEBSITE = 'https://github.com/rbreu/beeref'
+WEBSITE = 'https://beeref.org'
COPYRIGHT = 'Copyright © 2021 Rebecca Breu'
+
+COLORS = {
+ # Qt:
+ 'Active:Base': (60, 60, 60),
+ 'Active:Window': (40, 40, 40),
+ 'Active:Button': (40, 40, 40),
+ 'Active:Text': (200, 200, 200),
+ 'Active:HighlightedText': (255, 255, 255),
+ 'Active:WindowText': (200, 200, 200),
+ 'Active:ButtonText': (200, 200, 200),
+ 'Active:Highlight': (83, 167, 165),
+ 'Active:Link': (90, 181, 179),
+ 'Disabled:Light': (0, 0, 0),
+ 'Disabled:Text': (140, 140, 140),
+
+ # BeeRef specific:
+ 'Scene:Selection': (116, 234, 231),
+ 'Scene:Canvas': (60, 60, 60),
+}
diff --git a/beeref/gui.py b/beeref/gui.py
index c232979..002616f 100644
--- a/beeref/gui.py
+++ b/beeref/gui.py
@@ -37,7 +37,6 @@ class WelcomeOverlay(QtWidgets.QWidget):
self.setAttribute(Qt.WidgetAttribute.WA_NoSystemBackground)
self.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents)
label = QtWidgets.QLabel(self)
- label.setStyleSheet("QLabel { color: #cccccc; }")
label.setText(self.txt)
label.setAlignment(Qt.AlignmentFlag.AlignVCenter
| Qt.AlignmentFlag.AlignCenter)
diff --git a/beeref/selection.py b/beeref/selection.py
index 8c3fb1b..657b4d6 100644
--- a/beeref/selection.py
+++ b/beeref/selection.py
@@ -25,12 +25,13 @@ from PyQt6.QtWidgets import QGraphicsItem
from beeref.assets import BeeAssets
from beeref import commands
from beeref.config import CommandlineArgs
+from beeref.constants import COLORS
from beeref import utils
commandline_args = CommandlineArgs()
logger = logging.getLogger(__name__)
-SELECT_COLOR = QtGui.QColor(116, 234, 231, 255)
+SELECT_COLOR = QtGui.QColor(*COLORS['Scene:Selection'])
def with_anchor(func):
diff --git a/beeref/utils.py b/beeref/utils.py
index 339519e..d1ba24d 100644
--- a/beeref/utils.py
+++ b/beeref/utils.py
@@ -17,7 +17,37 @@ import logging.handlers
import os
import os.path
-from PyQt6 import QtCore
+from PyQt6 import QtCore, QtGui
+
+
+def create_palette_from_dict(conf):
+ """Create a palette from a config dictionary. Keys are a string of
+ 'ColourGroup:ColorRole' and values are a (r, g, b) tuple. E.g:
+ {
+ 'Active:WindowText': (80, 100, 0),
+ ...
+ }
+
+ Colors from the Active group will automatically be applied to the
+ Inactive group as well. Unknown color groups will be ignored.
+ """
+
+ palette = QtGui.QPalette()
+ for key, value in conf.items():
+ group, role = key.split(':')
+ if hasattr(QtGui.QPalette.ColorGroup, group):
+ palette.setColor(
+ getattr(QtGui.QPalette.ColorGroup, group),
+ getattr(QtGui.QPalette.ColorRole, role),
+ QtGui.QColor(*value))
+ if group == 'Active':
+ # Also set the Inactive colour group.
+ palette.setColor(
+ QtGui.QPalette.ColorGroup.Inactive,
+ getattr(QtGui.QPalette.ColorRole, role),
+ QtGui.QColor(*value))
+
+ return palette
def get_rect_from_points(point1, point2):
diff --git a/beeref/view.py b/beeref/view.py
index 91f4bd4..af1de8c 100644
--- a/beeref/view.py
+++ b/beeref/view.py
@@ -43,7 +43,8 @@ class BeeGraphicsView(QtWidgets.QGraphicsView, ActionsMixin):
self.settings = BeeSettings()
self.welcome_overlay = gui.WelcomeOverlay(self)
- self.setBackgroundBrush(QtGui.QBrush(QtGui.QColor(60, 60, 60)))
+ self.setBackgroundBrush(
+ QtGui.QBrush(QtGui.QColor(*constants.COLORS['Scene:Canvas'])))
self.setFrameShape(QtWidgets.QFrame.Shape.NoFrame)
self.setAcceptDrops(True)
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 48365a5..82f2356 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -2,11 +2,44 @@ import logging
import os.path
import pytest
-from PyQt6 import QtCore
+from PyQt6 import QtCore, QtGui
from beeref import utils
+def test_create_palette_from_dict_sets_qt_group():
+ conf = {'Disabled:WindowText': (44, 55, 66)}
+ palette = utils.create_palette_from_dict(conf)
+ color = palette.color(QtGui.QPalette.ColorGroup.Disabled,
+ QtGui.QPalette.ColorRole.WindowText)
+ assert color.getRgb() == (44, 55, 66, 255)
+ color_inactive = palette.color(QtGui.QPalette.ColorGroup.Inactive,
+ QtGui.QPalette.ColorRole.WindowText)
+ assert color_inactive.getRgb() != (44, 55, 66, 255)
+
+
+def test_create_palette_from_dict_active_group_also_sets_inactive():
+ conf = {'Active:WindowText': (44, 55, 66)}
+ palette = utils.create_palette_from_dict(conf)
+ color = palette.color(QtGui.QPalette.ColorGroup.Active,
+ QtGui.QPalette.ColorRole.WindowText)
+ assert color.getRgb() == (44, 55, 66, 255)
+ color_inactive = palette.color(QtGui.QPalette.ColorGroup.Inactive,
+ QtGui.QPalette.ColorRole.WindowText)
+ assert color_inactive.getRgb() == (44, 55, 66, 255)
+
+
+def test_create_palette_from_dict_ignores_unknown_group():
+ conf = {'Foo:WindowText': (44, 55, 66)}
+ palette = utils.create_palette_from_dict(conf)
+ color = palette.color(QtGui.QPalette.ColorGroup.Active,
+ QtGui.QPalette.ColorRole.WindowText)
+ assert color.getRgb() != (44, 55, 66, 255)
+ color_inactive = palette.color(QtGui.QPalette.ColorGroup.Inactive,
+ QtGui.QPalette.ColorRole.WindowText)
+ assert color_inactive.getRgb() != (44, 55, 66, 255)
+
+
def test_get_rect_from_points_given_topleft_bottomright():
rect = utils.get_rect_from_points(QtCore.QPointF(-10, -20),
QtCore.QPointF(30, 40))