Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions src/iv/imageviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
#include <QPalette>
#include <QProgressBar>
#include <QResizeEvent>
#include <QSettings>
#include <QSpinBox>
#include <QStatusBar>
#include <QStyleFactory>
#include <QTimer>

#if OIIO_QT_MAJOR < 6
Expand Down Expand Up @@ -99,7 +101,8 @@ static const char *s_file_filters = ""


ImageViewer::ImageViewer(bool use_ocio, const std::string& image_color_space,
const std::string& display, const std::string& view)
const std::string& display, const std::string& view,
bool dark)
: infoWindow(NULL)
, preferenceWindow(NULL)
, darkPaletteBox(NULL)
Expand All @@ -110,7 +113,7 @@ ImageViewer::ImageViewer(bool use_ocio, const std::string& image_color_space,
, m_zoom(1)
, m_fullscreen(false)
, m_default_gamma(1)
, m_darkPalette(false)
, m_darkPalette(dark)
, m_useOCIO(use_ocio)
, m_ocioColourSpace(image_color_space)
, m_ocioDisplay(display)
Expand All @@ -126,10 +129,26 @@ ImageViewer::ImageViewer(bool use_ocio, const std::string& image_color_space,
// Also, some time in the future we may want a real 3D LUT for
// "film look", etc.

if (darkPalette())
m_palette = QPalette(Qt::darkGray); // darkGray?
else
if (darkPalette()) {
QApplication::setStyle(QStyleFactory::create("Fusion"));
QPalette dp;
dp.setColor(QPalette::Window, QColor(53, 53, 53));
dp.setColor(QPalette::WindowText, Qt::white);
dp.setColor(QPalette::Base, QColor(25, 25, 25));
dp.setColor(QPalette::AlternateBase, QColor(53, 53, 53));
dp.setColor(QPalette::ToolTipBase, Qt::white);
dp.setColor(QPalette::ToolTipText, Qt::white);
dp.setColor(QPalette::Text, Qt::white);
dp.setColor(QPalette::Button, QColor(53, 53, 53));
dp.setColor(QPalette::ButtonText, Qt::white);
dp.setColor(QPalette::BrightText, Qt::red);
dp.setColor(QPalette::Link, QColor(42, 130, 218));
dp.setColor(QPalette::Highlight, QColor(42, 130, 218));
dp.setColor(QPalette::HighlightedText, Qt::black);
m_palette = dp;
} else {
m_palette = QPalette();
}
QApplication::setPalette(m_palette); // FIXME -- why not work?
this->setPalette(m_palette);

Expand Down
3 changes: 2 additions & 1 deletion src/iv/imageviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ class ImageViewer final : public QMainWindow {

public:
ImageViewer(bool use_ocio, const std::string& image_color_space,
const std::string& display, const std::string& view);
const std::string& display, const std::string& view,
bool dark = false);
~ImageViewer();

enum COLOR_MODE {
Expand Down
9 changes: 7 additions & 2 deletions src/iv/ivmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ getargs(int argc, char* argv[])
ap.arg("--rawcolor")
.help("Do not automatically transform to RGB");

ap.arg("--dark")
.help("Start in dark mode")
.dest("dark")
.store_true();

ap.arg("--display")
.help("OCIO display")
.metavar("STRING")
Expand Down Expand Up @@ -124,8 +129,8 @@ main(int argc, char* argv[])
#endif
}

ImageViewer* mainWin = new ImageViewer(use_ocio, color_space, display,
view);
ImageViewer* mainWin = new ImageViewer(use_ocio, color_space, display, view,
ap["dark"].get<int>());

mainWin->show();

Expand Down