Double the threshold of image area coverage for a fallback dominant color

This commit is contained in:
Kovid Goyal 2026-01-04 21:41:06 +05:30
parent e41a94d45b
commit dd675f96d5
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@
# Copyright: Andy C <achuongdev@gmail.com>, un_pogaz <un.pogaz@gmail.com>, Kovid Goyal <kovid@kovidgoyal.net>
# TODO:
# Remove py_dominant_color after beta release
# Remove python contrast_ratio after beta release
# Imports {{{
import bisect

View File

@ -679,7 +679,7 @@ QColor dominant_color(const QImage &image) { // {{{
float saturation = QColor(ans).saturationF();
// Look for more vibrant alternative if needed
if (saturation < 0.2 && sortedColors.size() > 1) {
const int min_num_pixels = (int)(0.05 * width * height);
const int min_num_pixels = (int)(0.1 * width * height);
for (qsizetype i = 1; i < limit; i++) {
float q = QColor(sortedColors[i].color).saturationF();
if (q > 0.3 && sortedColors[i].count > min_num_pixels) {