Skip to content

Commit

Permalink
Split indentation guide color from edge color in code editor settings
Browse files Browse the repository at this point in the history
Reusing the same color resulted in too subtle indentation guides
  • Loading branch information
nyalldawson committed Oct 12, 2020
1 parent cce7aa7 commit aaa813a
Show file tree
Hide file tree
Showing 6 changed files with 206 additions and 183 deletions.
Expand Up @@ -56,6 +56,7 @@ Defines a color scheme for use in QgsCodeEditor widgets.
Error,
FoldIconForeground,
FoldIconHalo,
IndentationGuide,
};

QgsCodeEditorColorScheme( const QString &id = QString(), const QString &name = QString() );
Expand Down
1 change: 1 addition & 0 deletions src/app/options/qgscodeeditoroptions.cpp
Expand Up @@ -68,6 +68,7 @@ QgsCodeEditorOptionsWidget::QgsCodeEditorOptionsWidget( QWidget *parent )
{QgsCodeEditorColorScheme::ColorRole::Error, mColorError },
{QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, mColorFoldIcon },
{QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, mColorFoldIconHalo },
{QgsCodeEditorColorScheme::ColorRole::IndentationGuide, mColorIndentation },
};

for ( auto it = mColorButtonMap.constBegin(); it != mColorButtonMap.constEnd(); ++it )
Expand Down
6 changes: 4 additions & 2 deletions src/gui/codeeditors/qgscodeeditor.cpp
Expand Up @@ -63,6 +63,7 @@ QMap< QgsCodeEditorColorScheme::ColorRole, QString > QgsCodeEditor::sColorRoleTo
{QgsCodeEditorColorScheme::ColorRole::Error, QStringLiteral( "stderrFontColor" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QStringLiteral( "foldIconForeground" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QStringLiteral( "foldIconHalo" ) },
{QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QStringLiteral( "indentationGuide" ) },
};


Expand Down Expand Up @@ -201,8 +202,8 @@ void QgsCodeEditor::runPostLexerConfigurationTasks()
SendScintilla( SCI_MARKERSETBACK, SC_MARKNUM_FOLDEROPEN, lexerColor( QgsCodeEditorColorScheme::ColorRole::FoldIconForeground ) );
SendScintilla( SCI_MARKERSETFORE, SC_MARKNUM_FOLDER, lexerColor( QgsCodeEditorColorScheme::ColorRole::FoldIconHalo ) );
SendScintilla( SCI_MARKERSETBACK, SC_MARKNUM_FOLDER, lexerColor( QgsCodeEditorColorScheme::ColorRole::FoldIconForeground ) );
SendScintilla( SCI_STYLESETFORE, STYLE_INDENTGUIDE, lexerColor( QgsCodeEditorColorScheme::ColorRole::Edge ) );
SendScintilla( SCI_STYLESETBACK, STYLE_INDENTGUIDE, lexerColor( QgsCodeEditorColorScheme::ColorRole::Edge ) );
SendScintilla( SCI_STYLESETFORE, STYLE_INDENTGUIDE, lexerColor( QgsCodeEditorColorScheme::ColorRole::IndentationGuide ) );
SendScintilla( SCI_STYLESETBACK, STYLE_INDENTGUIDE, lexerColor( QgsCodeEditorColorScheme::ColorRole::IndentationGuide ) );
}

void QgsCodeEditor::setSciWidget()
Expand Down Expand Up @@ -353,6 +354,7 @@ QColor QgsCodeEditor::defaultColor( QgsCodeEditorColorScheme::ColorRole role, co
{QgsCodeEditorColorScheme::ColorRole::Error, QStringLiteral( "stderrFontColor" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QStringLiteral( "foldIconForeground" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QStringLiteral( "foldIconHalo" ) },
{QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QStringLiteral( "indentationGuide" ) },
};

const QgsCodeEditorColorScheme defaultScheme = QgsGui::codeEditorColorSchemeRegistry()->scheme( QStringLiteral( "default" ) );
Expand Down
1 change: 1 addition & 0 deletions src/gui/codeeditors/qgscodeeditorcolorscheme.h
Expand Up @@ -69,6 +69,7 @@ class GUI_EXPORT QgsCodeEditorColorScheme
Error, //!< Error color
FoldIconForeground, //!< Fold icon foreground color
FoldIconHalo, //!< Fold icon halo color
IndentationGuide, //!< Indentation guide line
};

/**
Expand Down
3 changes: 3 additions & 0 deletions src/gui/codeeditors/qgscodeeditorcolorschemeregistry.cpp
Expand Up @@ -54,6 +54,7 @@ QgsCodeEditorColorSchemeRegistry::QgsCodeEditorColorSchemeRegistry()
{QgsCodeEditorColorScheme::ColorRole::Error, QColor( "#e31a1c" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QColor( "#ffffff" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QColor( "#000000" ) },
{QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QColor( "#d5d5d5" ) },
} );
addColorScheme( defaultScheme );

Expand Down Expand Up @@ -93,6 +94,7 @@ QgsCodeEditorColorSchemeRegistry::QgsCodeEditorColorSchemeRegistry()
{QgsCodeEditorColorScheme::ColorRole::Error, QColor( "#DC322F" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QColor( "#ffffff" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QColor( "#93a1a1" ) },
{QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QColor( "#c2beb3" ) },
} );
addColorScheme( solarizedLight );

Expand Down Expand Up @@ -132,6 +134,7 @@ QgsCodeEditorColorSchemeRegistry::QgsCodeEditorColorSchemeRegistry()
{QgsCodeEditorColorScheme::ColorRole::Error, QColor( "#DC322F" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QColor( "#586e75" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QColor( "#839496" ) },
{QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QColor( "#586E75" ) },
} );
addColorScheme( solarizedDark );
}
Expand Down

0 comments on commit aaa813a

Please sign in to comment.