From bea84a332033e75ed265f99b6eb63bac3e0b7e7c Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 4 Apr 2018 00:22:44 +0300 Subject: [PATCH] Script highlighter changed --- limereport/scripteditor/lrscripthighlighter.cpp | 9 ++------- limereport/scripteditor/lrscripthighlighter.h | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/limereport/scripteditor/lrscripthighlighter.cpp b/limereport/scripteditor/lrscripthighlighter.cpp index d6efa5b..0af09ba 100644 --- a/limereport/scripteditor/lrscripthighlighter.cpp +++ b/limereport/scripteditor/lrscripthighlighter.cpp @@ -1,4 +1,5 @@ #include "lrscripthighlighter.h" +#include "lrglobal.h" #include #include @@ -180,17 +181,11 @@ bool ScriptHighlighter::isKeyWord(const QString& word) return false; } -bool ScriptHighlighter::isDark(QColor color) -{ - double a = 1 - ( 0.299 * color.red() + 0.587 * color.green() + 0.114 * color.blue()) / 255; - return (a < 0.5); -} - ScriptHighlighter::ScriptHighlighter(QTextDocument* parent): QSyntaxHighlighter(parent) { - if ( isDark(QPalette().background().color())){ + if ( isColorDark(QPalette().background().color())){ m_formats[NumberFormat].setForeground(Qt::darkBlue); m_formats[StringFormat].setForeground(Qt::darkGreen); m_formats[KeywordFormat].setForeground(Qt::darkYellow); diff --git a/limereport/scripteditor/lrscripthighlighter.h b/limereport/scripteditor/lrscripthighlighter.h index 136b053..46c4d24 100644 --- a/limereport/scripteditor/lrscripthighlighter.h +++ b/limereport/scripteditor/lrscripthighlighter.h @@ -42,7 +42,6 @@ protected: }; QTextCharFormat m_formats[FormatsCount]; bool isKeyWord(const QString& word); - bool isDark(QColor color); void createParentheisisInfo(const char& literal, TextBlockData *data, const QString& text); };