mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-02-03 18:57:37 +01:00
generate just a bit better colors using HSV model
This commit is contained in:
parent
7d62aa44fc
commit
4694696c5d
@ -37,11 +37,11 @@ void ColorToolButton::setColor(const QColor& color) {
|
||||
}
|
||||
|
||||
void ColorToolButton::setRandomColor() {
|
||||
auto rnd_color = QRandomGenerator::global()->bounded(0xFFFFFF);
|
||||
auto rnd_color_name = QSL("#%1").arg(QString::number(rnd_color, 16));
|
||||
int hue = QRandomGenerator::global()->generate() % 360;
|
||||
auto clr = QColor::fromHsv(hue, 200, 240);
|
||||
|
||||
setColor(rnd_color_name);
|
||||
emit colorChanged(rnd_color_name);
|
||||
setColor(clr);
|
||||
emit colorChanged(clr);
|
||||
}
|
||||
|
||||
void ColorToolButton::paintEvent(QPaintEvent* e) {
|
||||
|
@ -37,10 +37,10 @@ QColor TextFactory::generateColorFromText(const QString& text) {
|
||||
color += chr.unicode();
|
||||
}
|
||||
|
||||
color = QRandomGenerator(color).bounded(double(0xFFFFFF)) - 1;
|
||||
auto color_name = QSL("#%1").arg(color, 6, 16);
|
||||
// NOTE: https://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically
|
||||
int hue = color % 360;
|
||||
|
||||
return QColor(color_name);
|
||||
return QColor::fromHsv(hue, 200, 240);
|
||||
}
|
||||
|
||||
int TextFactory::stringHeight(const QString& string, const QFontMetrics& metrics) {
|
||||
|
@ -214,7 +214,8 @@ void ServiceRoot::cleanAllItemsFromModel(bool clean_labels_too) {
|
||||
|
||||
for (RootItem* top_level_item : qAsConst(chi)) {
|
||||
if (top_level_item->kind() != RootItem::Kind::Bin && top_level_item->kind() != RootItem::Kind::Important &&
|
||||
top_level_item->kind() != RootItem::Kind::Unread && top_level_item->kind() != RootItem::Kind::Labels) {
|
||||
top_level_item->kind() != RootItem::Kind::Unread && top_level_item->kind() != RootItem::Kind::Probes &&
|
||||
top_level_item->kind() != RootItem::Kind::Labels) {
|
||||
requestItemRemoval(top_level_item);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user