/// <summary> /// Sets a style for an Error annotation (reduced font + segoe ui) and for markers /// </summary> /// <param name="errorLevel"></param> /// <param name="bgColor"></param> /// <param name="fgColor"></param> private static void SetErrorStyles(byte errorLevel, Color bgColor, Color fgColor) { int curFontSize = Sci.GetStyle(0).Size; var normalStyle = Sci.GetStyle(FilesInfo.GetStyleOf((ErrorLevel)errorLevel, ErrorFontWeight.Normal)); normalStyle.Font = "Segoe ui"; normalStyle.Size = (int)(curFontSize * 0.9); normalStyle.ForeColor = fgColor; normalStyle.BackColor = bgColor; var boldStyle = Sci.GetStyle(FilesInfo.GetStyleOf((ErrorLevel)errorLevel, ErrorFontWeight.Bold)); boldStyle.Font = "Segoe ui"; boldStyle.Size = (int)(curFontSize * 0.9); boldStyle.Bold = true; boldStyle.ForeColor = fgColor; boldStyle.BackColor = bgColor; var italicStyle = Sci.GetStyle(FilesInfo.GetStyleOf((ErrorLevel)errorLevel, ErrorFontWeight.Italic)); italicStyle.Font = "Segoe ui"; italicStyle.Size = (int)(curFontSize * 0.9); italicStyle.Italic = true; italicStyle.ForeColor = fgColor; italicStyle.BackColor = bgColor; var markerStyle = Sci.GetMarker(errorLevel); markerStyle.Symbol = MarkerSymbol.SmallRect; markerStyle.SetBackColor(bgColor); markerStyle.SetForeColor(fgColor); }
/// <summary> /// Call this method to set the back/fore color and font type of each type used in 3P according to the /// styles defined in the SyntaxHighlighting file /// </summary> public void SetScintillaStyles() { // Default SetFontStyle((byte)SciMsg.STYLE_DEFAULT, GetStyle(SciStyleId.Default)); SetFontStyle((byte)SciMsg.STYLE_CONTROLCHAR, GetStyle(SciStyleId.Default)); foreach (var kpv in Items) { SetFontStyle((byte)kpv.Key, kpv.Value); } // line numbers SetFontStyle((byte)SciMsg.STYLE_LINENUMBER, GetStyle(SciStyleId.LineNumberMargin)); // set url as strings SetFontStyle(80, GetStyle(SciStyleId.SimpleQuote)); // brace highlighting SetFontStyle((byte)SciMsg.STYLE_BRACELIGHT, GetStyle(SciStyleId.BraceHighLight)); SetFontStyle((byte)SciMsg.STYLE_BRACEBAD, GetStyle(SciStyleId.BadBraceHighLight)); // smart highlighting in npp Sci.GetIndicator(29).ForeColor = GetStyle(SciStyleId.SmartHighLighting).ForeColor; // Setting styles for errors SetErrorStyles((byte)ErrorLevel.Information, GetStyle(SciStyleId.Error0)); SetErrorStyles((byte)ErrorLevel.Warning, GetStyle(SciStyleId.Error1)); SetErrorStyles((byte)ErrorLevel.StrongWarning, GetStyle(SciStyleId.Error2)); SetErrorStyles((byte)ErrorLevel.Error, GetStyle(SciStyleId.Error3)); SetErrorStyles((byte)ErrorLevel.Critical, GetStyle(SciStyleId.Error4)); Sci.SetIndentGuideColor(GetStyle(SciStyleId.WhiteSpace).BackColor, GetStyle(SciStyleId.WhiteSpace).ForeColor); Sci.SetWhiteSpaceColor(true, Color.Transparent, GetStyle(SciStyleId.WhiteSpace).ForeColor); Sci.SetSelectionColor(true, GetStyle(SciStyleId.Selection).BackColor, Color.Transparent); Sci.CaretLineBackColor = GetStyle(SciStyleId.CaretLine).BackColor; Sci.CaretColor = GetStyle(SciStyleId.CaretColor).ForeColor; // Set colors for all folding markers and margin Sci.SetFoldMarginColors(true, GetStyle(SciStyleId.FoldMargin).BackColor, GetStyle(SciStyleId.FoldMargin).BackColor); Sci.SetFoldMarginMarkersColor(GetStyle(SciStyleId.FoldMargin).ForeColor, GetStyle(SciStyleId.FoldMargin).BackColor, GetStyle(SciStyleId.FoldActiveMarker).ForeColor); // Configure folding markers with respective symbols Sci.GetMarker(Sci.Marker.FolderEnd).Symbol = MarkerSymbol.BoxPlusConnected; Sci.GetMarker(Sci.Marker.Folder).Symbol = MarkerSymbol.BoxPlus; Sci.GetMarker(Sci.Marker.FolderMidTail).Symbol = MarkerSymbol.TCorner; Sci.GetMarker(Sci.Marker.FolderOpenMid).Symbol = MarkerSymbol.BoxMinusConnected; Sci.GetMarker(Sci.Marker.FolderSub).Symbol = MarkerSymbol.VLine; Sci.GetMarker(Sci.Marker.FolderTail).Symbol = MarkerSymbol.LCorner; Sci.GetMarker(Sci.Marker.FolderOpen).Symbol = MarkerSymbol.BoxMinus; }