mirror of
https://github.com/YACReader/yacreader
synced 2026-04-12 15:49:53 -04:00
Make flow ribbons themeable
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
{
|
||||
"comicFlow": {
|
||||
"backgroundColor": "#000000",
|
||||
"readMainColor": "#db4725",
|
||||
"readTickColor": "#8a2c17",
|
||||
"readingColor": "#e6b90f",
|
||||
"textColor": "#4c4c4c"
|
||||
},
|
||||
"comicsViewTable": {
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
{
|
||||
"comicFlow": {
|
||||
"backgroundColor": "#111111",
|
||||
"readMainColor": "#db4725",
|
||||
"readTickColor": "#8a2c17",
|
||||
"readingColor": "#e6b90f",
|
||||
"textColor": "#888888"
|
||||
},
|
||||
"comicsViewTable": {
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
{
|
||||
"comicFlow": {
|
||||
"backgroundColor": "#dcdcdc",
|
||||
"readMainColor": "#db4725",
|
||||
"readTickColor": "#8a2c17",
|
||||
"readingColor": "#e6b90f",
|
||||
"textColor": "#303030"
|
||||
},
|
||||
"comicsViewTable": {
|
||||
|
||||
@ -92,9 +92,11 @@ struct MetadataScraperDialogThemeTemplates {
|
||||
QSize rowIconSize = QSize(8, 7);
|
||||
};
|
||||
|
||||
struct ComicFlowColors {
|
||||
struct ComicFlowTheme {
|
||||
QColor backgroundColor;
|
||||
QColor textColor;
|
||||
QPixmap readPixmap;
|
||||
QPixmap readingPixmap;
|
||||
};
|
||||
|
||||
struct ComicsViewTableThemeTemplates {
|
||||
@ -484,7 +486,7 @@ struct Theme {
|
||||
ThemeMeta meta;
|
||||
QJsonObject sourceJson;
|
||||
|
||||
ComicFlowColors comicFlow;
|
||||
ComicFlowTheme comicFlow;
|
||||
MetadataScraperDialogTheme metadataScraperDialog;
|
||||
HelpAboutDialogTheme helpAboutDialog;
|
||||
WhatsNewDialogTheme whatsNewDialog;
|
||||
|
||||
@ -330,10 +330,18 @@ struct WhatsNewDialogParams {
|
||||
QColor headerDecorationColor;
|
||||
};
|
||||
|
||||
struct ComicFlowParams {
|
||||
QColor backgroundColor;
|
||||
QColor textColor;
|
||||
QColor readMainColor; // Main ribbon color for read state (#f0f in readRibbon.svg)
|
||||
QColor readTickColor; // Tick color for read state (#0ff in readRibbon.svg)
|
||||
QColor readingColor; // Main ribbon color for reading state (#f0f in readingRibbon.svg)
|
||||
};
|
||||
|
||||
struct ThemeParams {
|
||||
ThemeMeta meta;
|
||||
|
||||
ComicFlowColors comicFlowColors;
|
||||
ComicFlowParams comicFlowParams;
|
||||
MetadataScraperDialogParams metadataScraperDialogParams;
|
||||
HelpAboutDialogTheme helpAboutDialogParams;
|
||||
EmptyContainerParams emptyContainerParams;
|
||||
@ -361,10 +369,22 @@ Theme makeTheme(const ThemeParams ¶ms)
|
||||
Theme theme;
|
||||
|
||||
// Comic Flow
|
||||
const auto &cf = params.comicFlowColors;
|
||||
const auto &cf = params.comicFlowParams;
|
||||
theme.comicFlow.backgroundColor = cf.backgroundColor;
|
||||
theme.comicFlow.textColor = cf.textColor;
|
||||
|
||||
{
|
||||
const qreal dpr = qApp->devicePixelRatio();
|
||||
// readRibbon: #f0f (main) + #0ff (tick)
|
||||
theme.comicFlow.readPixmap = renderSvgToPixmap(
|
||||
recoloredSvgToThemeFile(":/images/readRibbon.svg", cf.readMainColor, cf.readTickColor, params.meta.id),
|
||||
100, 136, dpr);
|
||||
// readingRibbon: #f0f (main)
|
||||
theme.comicFlow.readingPixmap = renderSvgToPixmap(
|
||||
recoloredSvgToThemeFile(":/images/readingRibbon.svg", cf.readingColor, params.meta.id),
|
||||
100, 136, dpr);
|
||||
}
|
||||
|
||||
// MetadataScraperDialog
|
||||
const auto &msd = params.metadataScraperDialogParams;
|
||||
const auto &t = msd.t;
|
||||
@ -918,8 +938,11 @@ Theme makeTheme(const QJsonObject &json)
|
||||
|
||||
if (json.contains("comicFlow")) {
|
||||
const auto o = json["comicFlow"].toObject();
|
||||
p.comicFlowColors.backgroundColor = colorFromJson(o, "backgroundColor", p.comicFlowColors.backgroundColor);
|
||||
p.comicFlowColors.textColor = colorFromJson(o, "textColor", p.comicFlowColors.textColor);
|
||||
p.comicFlowParams.backgroundColor = colorFromJson(o, "backgroundColor", p.comicFlowParams.backgroundColor);
|
||||
p.comicFlowParams.textColor = colorFromJson(o, "textColor", p.comicFlowParams.textColor);
|
||||
p.comicFlowParams.readMainColor = colorFromJson(o, "readMainColor", p.comicFlowParams.readMainColor);
|
||||
p.comicFlowParams.readTickColor = colorFromJson(o, "readTickColor", p.comicFlowParams.readTickColor);
|
||||
p.comicFlowParams.readingColor = colorFromJson(o, "readingColor", p.comicFlowParams.readingColor);
|
||||
}
|
||||
|
||||
if (json.contains("metadataScraperDialog")) {
|
||||
|
||||
Reference in New Issue
Block a user