mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-24 04:33:03 +03:00
Script highlighter changed
This commit is contained in:
parent
ab3236f669
commit
bea84a3320
@ -1,4 +1,5 @@
|
||||
#include "lrscripthighlighter.h"
|
||||
#include "lrglobal.h"
|
||||
#include <QDebug>
|
||||
#include <QPalette>
|
||||
|
||||
@ -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);
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user