/// <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); }
public static void SetFontStyle(byte styleNumber, StyleThemeItem styleItem) { var nppStyle = Sci.GetStyle(styleNumber); if (styleItem.BackColor != Color.Transparent) { nppStyle.BackColor = styleItem.BackColor; } if (styleItem.ForeColor != Color.Transparent) { nppStyle.ForeColor = styleItem.ForeColor; } if (styleItem.FontType > 0) { nppStyle.Bold = styleItem.FontType.IsBitSet(1); nppStyle.Italic = styleItem.FontType.IsBitSet(2); } if (!string.IsNullOrEmpty(styleItem.FontName)) { nppStyle.Font = styleItem.FontName; } }