1919#include < iterator>
2020
2121#include < QApplication>
22+ #include < QStyleFactory>
23+ #include < QPalette>
2224
2325#include " imageviewer.h"
2426#include < OpenImageIO/argparse.h>
@@ -58,6 +60,13 @@ getargs(int argc, char* argv[])
5860 ap.arg (" --rawcolor" )
5961 .help (" Do not automatically transform to RGB" );
6062
63+ // --- DARK MODE ARGUMENT ---
64+ ap.arg (" --dark" )
65+ .help (" Start in dark mode" )
66+ .dest (" dark" )
67+ .store_true ();
68+ // -------------------------
69+
6170 ap.arg (" --display" )
6271 .help (" OCIO display" )
6372 .metavar (" STRING" )
@@ -109,6 +118,27 @@ main(int argc, char* argv[])
109118 // Q_INIT_RESOURCE(iv);
110119 QApplication app (argc, argv);
111120
121+ // --- START DARK MODE IMPLEMENTATION ---
122+ if (ap[" dark" ].get <int >()) {
123+ app.setStyle (QStyleFactory::create (" Fusion" ));
124+ QPalette darkPalette;
125+ darkPalette.setColor (QPalette::Window, QColor (53 , 53 , 53 ));
126+ darkPalette.setColor (QPalette::WindowText, Qt::white);
127+ darkPalette.setColor (QPalette::Base, QColor (25 , 25 , 25 ));
128+ darkPalette.setColor (QPalette::AlternateBase, QColor (53 , 53 , 53 ));
129+ darkPalette.setColor (QPalette::ToolTipBase, Qt::white);
130+ darkPalette.setColor (QPalette::ToolTipText, Qt::white);
131+ darkPalette.setColor (QPalette::Text, Qt::white);
132+ darkPalette.setColor (QPalette::Button, QColor (53 , 53 , 53 ));
133+ darkPalette.setColor (QPalette::ButtonText, Qt::white);
134+ darkPalette.setColor (QPalette::BrightText, Qt::red);
135+ darkPalette.setColor (QPalette::Link, QColor (42 , 130 , 218 ));
136+ darkPalette.setColor (QPalette::Highlight, QColor (42 , 130 , 218 ));
137+ darkPalette.setColor (QPalette::HighlightedText, Qt::black);
138+ app.setPalette (darkPalette);
139+ }
140+ // --------------------------------------
141+
112142 std::string color_space = ap[" image-color-space" ].as_string (" " );
113143 std::string display = ap[" display" ].as_string (" " );
114144 std::string view = ap[" view" ].as_string (" " );
@@ -216,4 +246,4 @@ main(int argc, char* argv[])
216246 }
217247 shutdown ();
218248 return r;
219- }
249+ }
0 commit comments