[Gnucash-changes] r13428 - gnucash/trunk - Andreas Köhler's patch to correctly build a html color value. Fixes

David Hampton hampton at cvs.gnucash.org
Tue Feb 28 22:28:49 EST 2006


Author: hampton
Date: 2006-02-28 22:28:49 -0500 (Tue, 28 Feb 2006)
New Revision: 13428
Trac: http://svn.gnucash.org/trac/changeset/13428

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/app-utils/options.scm
Log:
Andreas Köhler's patch to correctly build a html color value. Fixes
328933.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-02-28 23:13:33 UTC (rev 13427)
+++ gnucash/trunk/ChangeLog	2006-03-01 03:28:49 UTC (rev 13428)
@@ -1,3 +1,8 @@
+2006-02-28  David Hampton  <hampton at employees.org>
+
+	* src/app-utils/options.scm: Andreas Köhler's patch to correctly
+	build a html color value. Fixes 328933.
+
 2006-02-28  Joshua Sled  <jsled at asynchronous.org>
 
 	* src/bin/gnucash-bin.c (gnucash_command_line): Terminate

Modified: gnucash/trunk/src/app-utils/options.scm
===================================================================
--- gnucash/trunk/src/app-utils/options.scm	2006-02-28 23:13:33 UTC (rev 13427)
+++ gnucash/trunk/src/app-utils/options.scm	2006-03-01 03:28:49 UTC (rev 13428)
@@ -1159,13 +1159,17 @@
     (inexact->exact
      (min 255.0
           (truncate (* (/ 255.0 range) value)))))
+  (define (number->hex-string number)
+    (let ((ret (number->string number 16)))
+      (cond ((< (string-length ret) 2) (string-append "0" ret))
+            (else ret))))
   (let ((red (car color))
         (green (cadr color))
         (blue (caddr color)))
     (string-append
-     (number->string (html-value red) 16)
-     (number->string (html-value green) 16)
-     (number->string (html-value blue) 16))))
+     (number->hex-string (html-value red))
+     (number->hex-string (html-value green))
+     (number->hex-string (html-value blue)))))
 
 (define (gnc:color->html color range)
     (string-append "#"



More information about the gnucash-changes mailing list