Use RGB instead of RGBA for color set for color

This commit is contained in:
John Ralls 2021-08-12 14:28:44 -07:00
parent a7f0476af9
commit 86da12d844
2 changed files with 11 additions and 6 deletions

View File

@ -261,12 +261,12 @@ dialog_changed_internal (GtkWidget *widget, bool sensitive)
_("_Close"));
}
g_list_free (children);
break; // Found the button-box, no need to continue.
break; // Found the button-box, no need to continue.
}
}
}
g_list_free (children);
break; // Found the box, no need to continue.
}
break; // Found the box, no need to continue.
}
}
g_list_free (children);
}
@ -2157,7 +2157,12 @@ public:
(uint8_t)(color.green * 255),
(uint8_t)(color.blue * 255),
(uint8_t)(color.alpha * 255));
option.set_value(std::string{rgba_str});
auto rgb_str = g_strdup_printf("%2x%2x%2x",
(uint8_t)(color.red * 255),
(uint8_t)(color.green * 255),
(uint8_t)(color.blue * 255));
// Hello World uses an old HTML4 attribute that doesn't understand alpha.
option.set_value(std::string{rgb_str});
g_free(rgba_str);
}
};

View File

@ -157,7 +157,7 @@
(gnc-make-string-option section name key docstring default (GncOptionUIType-FONT)))
(define-public (gnc:make-color-option section name key docstring colors range use-alpha)
(issue-deprecation-warning "gnc:make-color-option is deprecated. Make and register the option in one command with gnc-register-color-option.")
(let ((color-str (if use-alpha
(let ((color-str (if use-alpha ;; It's always false...
(format #f "~x~x~x~x" (car colors) (cadr colors) (caddr colors) (cadddr colors))
(format #f "~x~x~x" (car colors) (cadr colors) (caddr colors)))))
(gnc-make-string-option section name key docstring color-str (GncOptionUIType-COLOR))))