Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Commit

Permalink
Merge pull request #4531 from mono/fix529478-editor-search-marker-fal…
Browse files Browse the repository at this point in the history
…lback-color

[529478][Editor] Fix search marker fallback color
  • Loading branch information
slluis authored Apr 13, 2018
2 parents d555bbd + 330e8f4 commit 7774db2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -900,15 +900,11 @@ void GetSearchResultIndicator (IndicatorDrawingState state, IEnumerator<ISegment

void DrawSearchResults (Cairo.Context cr, IndicatorDrawingState state, int i)
{
var color = SyntaxHighlightingService.GetColor (TextEditor.EditorTheme, EditorThemeColors.FindHighlight);
if (i == state.MainSelection) {
// TODO: EditorTheme does that look ok ?
if (HslColor.Brightness (color) < 0.5) {
color = color.AddLight (0.1);
} else {
color = color.AddLight (-0.1);
}
}
bool isSelected = i == state.MainSelection;
var color = SyntaxHighlightingService.GetColor (TextEditor.EditorTheme, isSelected ? EditorThemeColors.Selection : EditorThemeColors.FindHighlight);
if (Math.Abs (HslColor.Brightness (color) - HslColor.Brightness (SyntaxHighlightingService.GetColor (TextEditor.EditorTheme, EditorThemeColors.Background))) < 0.1)
color = isSelected ? Styles.Editor.SearchMarkerSelectedFallbackColor : Styles.Editor.SearchMarkerFallbackColor;

cr.SetSourceColor (color);
cr.Rectangle (barPadding, state.SearchResultIndicators[i], Allocation.Width - barPadding * 2, 2);
cr.Fill ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ public static implicit operator Xwt.Drawing.Color (HslColor hsl)
return new Xwt.Drawing.Color (r, g, b, hsl.Alpha);
}

public static implicit operator HslColor (Xwt.Drawing.Color color)
{
return new HslColor (color.Red, color.Green, color.Blue, color.Alpha);
}

public static implicit operator HslColor (Color color)
{
return new HslColor (color);
Expand Down
5 changes: 5 additions & 0 deletions main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Styles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ public static class Editor
public static Color SmartTagMarkerColorLight { get; internal set; }
public static Color SmartTagMarkerColorDark { get; internal set; }
public static Color SearchErrorForegroundColor { get; internal set; }
public static Color SearchMarkerFallbackColor { get; internal set; }
public static Color SearchMarkerSelectedFallbackColor { get; internal set; }
}

public static class KeyBindingsPanel
Expand Down Expand Up @@ -431,6 +433,9 @@ internal static void LoadStyle ()
Editor.SmartTagMarkerColorLight = Color.FromName ("#ff70fe").WithAlpha (.5);
Editor.SmartTagMarkerColorDark = Color.FromName ("#ffffff").WithAlpha (.5);
Editor.SearchErrorForegroundColor = ErrorForegroundColor;
Editor.SearchMarkerFallbackColor = Color.FromName ("#f3da2d");
// TODO: FINAL COLOR!
Editor.SearchMarkerSelectedFallbackColor = Color.FromName ("#ff00ff");

// Key Bindings Preferences

Expand Down

0 comments on commit 7774db2

Please sign in to comment.