Dark mode support

Centralized all colors, tweaked application paletter in darkmode to make it darker.
This commit is contained in:
eelke 2025-02-23 08:32:15 +01:00
parent aac55b0ed1
commit 86a9a0d709
19 changed files with 335 additions and 73 deletions

View file

@ -1,10 +1,36 @@
#pragma once
#include "Pgsql_declare.h"
#include "Pgsql_oids.h"
#include <QAbstractTableModel>
#include <QColor>
#include <util/Colors.h>
Qt::Alignment GetDefaultAlignmentForType(Oid oid);
QColor GetDefaultColorForType(Oid oid);
// inline QColor GetDefaultColorForType(Oid oid)
// {
// using namespace Pgsql;
// const ColorTheme &theme = GetColorTheme();
// QColor c;
// switch (oid) {
// case int2_oid:
// case int4_oid:
// case int8_oid:
// c = theme.integerColor;
// break;
// case float4_oid:
// case float8_oid:
// c = theme.floatColor;
// break;
// case numeric_oid:
// c = theme.numericColor;
// break;
// case oid_oid:
// case bool_oid:
// default:
// c = Qt::black;
// }
// return c;
// }
inline Qt::Alignment GetDefaultAlignment() { return Qt::AlignLeft | Qt::AlignVCenter; }
inline Qt::Alignment GetDefaultBoolAlignment() { return Qt::AlignCenter | Qt::AlignVCenter; }
@ -12,13 +38,14 @@ inline Qt::Alignment GetDefaultNumberAlignment() { return Qt::AlignRight | Qt::A
inline QColor GetDefaultBoolColor(bool v)
{
return v ? Qt::darkGreen : Qt::darkRed;
const ColorTheme& colorTheme = GetColorTheme();
return v ? colorTheme.booleanTrue : colorTheme.booleanFalse;
}
inline QColor GetDefaultIntegerColor() { return Qt::darkBlue; }
inline QColor GetDefaultFloatColor() { return Qt::darkCyan; }
inline QColor GetDefaultNumericColor() { return Qt::darkGreen; }
inline QColor GetDefaultNullColor() { return Qt::gray; }
// inline QColor GetDefaultIntegerColor() { return Qt::darkBlue; }
// inline QColor GetDefaultFloatColor() { return Qt::darkCyan; }
// inline QColor GetDefaultNumericColor() { return Qt::darkGreen; }
// inline QColor GetDefaultNullColor() { return Qt::gray; }
QString FormatBoolForDisplay(bool v);