]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
fix default font color for legend (#8139)
authorLeeLenaleee <39033624+LeeLenaleee@users.noreply.github.com>
Sat, 5 Dec 2020 19:34:34 +0000 (20:34 +0100)
committerGitHub <noreply@github.com>
Sat, 5 Dec 2020 19:34:34 +0000 (14:34 -0500)
* fix default font color for legend
* adjusted docs to be consistent with fontColor to color

docs/docs/configuration/legend.md
src/plugins/plugin.legend.js

index a2446b2ce7150e44bb2e492da5afcbcf2092dcea..6a4733e050c513ca60bb7e2c1f47b0daa96f19c8 100644 (file)
@@ -125,7 +125,7 @@ var chart = new Chart(ctx, {
             legend: {
                 display: true,
                 labels: {
-                    fontColor: 'rgb(255, 99, 132)'
+                    color: 'rgb(255, 99, 132)'
                 }
             }
         }
index ef33ae0da34dfbd423387cc58056e5e6f7119012..529f82a773e99260a3a5fa20cc37e9425d6abcd0 100644 (file)
@@ -311,7 +311,7 @@ export class Legend extends Element {
                const rtlHelper = getRtlAdapter(opts.rtl, me.left, me._minSize.width);
                const ctx = me.ctx;
                const labelFont = toFont(labelOpts.font, me.chart.options.font);
-               const fontColor = labelOpts.color;
+               const fontColor = labelOpts.color || defaultColor;
                const fontSize = labelFont.size;
                let cursor;