Skip to content

Commit

Permalink
chore: reset python light theme color
Browse files Browse the repository at this point in the history
Log:
Change-Id: I9240e972c526df394dc92eb1c1ef93240470bcab
  • Loading branch information
deepin-mozart committed Dec 18, 2023
1 parent 07b6e44 commit e798777
Showing 1 changed file with 26 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ int StyleSciPython::sectionEnd() const
return SCE_P_FTRIPLEDOUBLE;
}

int lightToDark(int color)
{
return 0xFFFFFF - color;
}

void StyleSciPython::setThemeColor(DGuiApplicationHelper::ColorType colorType)
{
StyleSci::setThemeColor(colorType);
Expand Down Expand Up @@ -82,44 +87,46 @@ void StyleSciPython::setThemeColor(DGuiApplicationHelper::ColorType colorType)
tempFore = StyleColor::color(tempObj.value(StyleJsonFile::Key_2::get()->Foreground).toString().toInt(nullptr, 16));
edit()->styleSetFore(SCE_P_OPERATOR, tempFore); // 符号
} else { // TODO(mozart):same with dark,should use light theme.
edit()->styleSetFore(SCE_P_DEFAULT, StyleColor::color(StyleColor::Table::get()->DarkBlue));

tempObj = jsonFile->value(StyleJsonFile::Key_1::get()->Comment).toObject();
tempFore = StyleColor::color(tempObj.value(StyleJsonFile::Key_2::get()->Foreground).toString().toInt(nullptr, 16));
edit()->styleSetFore(SCE_P_COMMENTLINE, tempFore);
edit()->styleSetFore(SCE_P_COMMENTBLOCK, tempFore);
edit()->styleSetFore(SCE_P_COMMENTLINE, lightToDark(tempFore));
edit()->styleSetFore(SCE_P_COMMENTBLOCK, lightToDark(tempFore));

tempObj = jsonFile->value(StyleJsonFile::Key_1::get()->Class).toObject();
tempFore = StyleColor::color(tempObj.value(StyleJsonFile::Key_2::get()->Foreground).toString().toInt(nullptr, 16));
edit()->styleSetFore(SCE_P_CLASSNAME, tempFore);
edit()->styleSetFore(SCE_P_DEFNAME, tempFore);
edit()->styleSetFore(SCE_P_TRIPLE, tempFore);
edit()->styleSetFore(SCE_P_TRIPLEDOUBLE, tempFore);
edit()->styleSetFore(SCE_P_CLASSNAME, lightToDark(tempFore));
edit()->styleSetFore(SCE_P_DEFNAME, lightToDark(tempFore));
edit()->styleSetFore(SCE_P_TRIPLE, lightToDark(tempFore));
edit()->styleSetFore(SCE_P_TRIPLEDOUBLE, lightToDark(tempFore));

tempObj = jsonFile->value(StyleJsonFile::Key_1::get()->Variable).toObject();
tempFore = StyleColor::color(tempObj.value(StyleJsonFile::Key_2::get()->Foreground).toString().toInt(nullptr, 16));
edit()->styleSetFore(SCE_P_IDENTIFIER, tempFore);
edit()->styleSetFore(SCE_P_IDENTIFIER, lightToDark(tempFore));

tempObj = jsonFile->value(StyleJsonFile::Key_1::get()->Number).toObject();
tempFore = StyleColor::color(tempObj.value(StyleJsonFile::Key_2::get()->Foreground).toString().toInt(nullptr, 16));
edit()->styleSetFore(SCE_P_NUMBER, tempFore);
edit()->styleSetFore(SCE_P_NUMBER, lightToDark(tempFore));

tempObj = jsonFile->value(StyleJsonFile::Key_1::get()->Keyword).toObject();
tempFore = StyleColor::color(tempObj.value(StyleJsonFile::Key_2::get()->Foreground).toString().toInt(nullptr, 16));
edit()->styleSetFore(SCE_P_WORD, tempFore);
edit()->styleSetFore(SCE_P_WORD2, tempFore);
edit()->styleSetFore(SCE_P_WORD, lightToDark(tempFore));
edit()->styleSetFore(SCE_P_WORD2, lightToDark(tempFore));

tempObj = jsonFile->value(StyleJsonFile::Key_1::get()->String).toObject();
tempFore = StyleColor::color(tempObj.value(StyleJsonFile::Key_2::get()->Foreground).toString().toInt(nullptr, 16));
edit()->styleSetFore(SCE_P_STRING, tempFore);
edit()->styleSetFore(SCE_P_CHARACTER, tempFore);
edit()->styleSetFore(SCE_P_STRINGEOL, tempFore);
edit()->styleSetFore(SCE_P_DECORATOR, tempFore);
edit()->styleSetFore(SCE_P_FSTRING, tempFore);
edit()->styleSetFore(SCE_P_FCHARACTER, tempFore);
edit()->styleSetFore(SCE_P_FTRIPLE, tempFore);
edit()->styleSetFore(SCE_P_FTRIPLEDOUBLE, tempFore);
edit()->styleSetFore(SCE_P_STRING, lightToDark(tempFore));
edit()->styleSetFore(SCE_P_CHARACTER, lightToDark(tempFore));
edit()->styleSetFore(SCE_P_STRINGEOL, lightToDark(tempFore));
edit()->styleSetFore(SCE_P_DECORATOR, lightToDark(tempFore));
edit()->styleSetFore(SCE_P_FSTRING, lightToDark(tempFore));
edit()->styleSetFore(SCE_P_FCHARACTER, lightToDark(tempFore));
edit()->styleSetFore(SCE_P_FTRIPLE, lightToDark(tempFore));
edit()->styleSetFore(SCE_P_FTRIPLEDOUBLE, lightToDark(tempFore));

tempObj = jsonFile->value(StyleJsonFile::Key_1::get()->Operators).toObject();
tempFore = StyleColor::color(tempObj.value(StyleJsonFile::Key_2::get()->Foreground).toString().toInt(nullptr, 16));
edit()->styleSetFore(SCE_P_OPERATOR, tempFore); // 符号
edit()->styleSetFore(SCE_P_OPERATOR, lightToDark(tempFore)); // 符号
}
}

0 comments on commit e798777

Please sign in to comment.