ソースを参照

improve chart colors to look ok on Brave's "Night Mode"

Pi 1 年間 前
コミット
0c981e3a0e
1 ファイル変更20 行追加6 行削除
  1. 20 6
      app/rest/trend.py

+ 20 - 6
app/rest/trend.py

@@ -69,7 +69,21 @@ def trend_internal(conn: Connection[TupleRow], path: str, query: DictProperty):
             
             sns.set(style="darkgrid", palette='pastel', context="talk")
             plt.style.use("dark_background")
-            plt.rcParams.update({"grid.linewidth":0.1, "grid.alpha":0.5})
+            plt.rcParams.update({
+    "lines.color": "#ffffff",
+    "patch.edgecolor": "#ffffff",
+    "text.color": "#ffffff",
+    "axes.facecolor": "#7f7f7f",
+    "axes.edgecolor": "#ffffff",
+    "axes.labelcolor": "#ffffff",
+    "xtick.color": "#ffffff",
+    "ytick.color": "#ffffff",
+    "grid.color": "#ffffff",
+    "figure.facecolor": "#7f7f7f",
+    "figure.edgecolor": "#7f7f7f",
+    "savefig.facecolor": "#7f7f7f",
+    "savefig.edgecolor": "#7f7f7f"})
+            plt.rcParams.update({"grid.linewidth":0.2, "grid.alpha":0.5})
             plt.figure(figsize=[16, 9], layout="tight")
             xlabel='Time'
             ylabel=f'$ / {unit}'
@@ -79,17 +93,17 @@ def trend_internal(conn: Connection[TupleRow], path: str, query: DictProperty):
                 ax = sns.lineplot(data=pivot, markers=True)
                 legend = plt.figlegend(
                     loc='upper center', ncol=6,
-                    title_fontsize="14", fontsize="12", labelcolor='#a0a0a0',
+                    title_fontsize="14", fontsize="12", labelcolor='#ffffff',
                     framealpha=0.5
                 )
                 legend.set_title(title="Products")
             ax.legend().set_visible(False)
 
-            ax.set_xlabel(xlabel, color='#a0a0a0', fontsize="14")
-            ax.set_ylabel(ylabel, color='#a0a0a0', fontsize="14")
-            ax.axes.tick_params(colors='#a0a0a0', labelsize="12", which='both')
+            ax.set_xlabel(xlabel, fontsize="14")
+            ax.set_ylabel(ylabel, fontsize="14")
+            ax.axes.tick_params(labelsize="12", which='both')
             for _, spine in ax.spines.items():
-                spine.set_color('#a0a0a0')
+                spine.set_color('#ffffff')
             
             progress[-1]["status"] = "done"
             yield template("loading", progress=progress)