/// <summary> /// Initializes a new instance of the <see cref="ColorConsole"/> class. /// </summary> /// <param name="style">The color style to use.</param> public ColorConsole(ColorStyle style) { #if !SILVERLIGHT && !NETCF _originalColor = Console.ForegroundColor; Console.ForegroundColor = GetColor(style); #endif }
public static ConsoleColor GetColor(ColorStyle style) { ConsoleColor colorForStyle = ColorConsole.GetColorForStyle(style); ConsoleColor backgroundColor = Console.BackgroundColor; if (colorForStyle != backgroundColor && (colorForStyle != ConsoleColor.Red || backgroundColor != ConsoleColor.Magenta)) return colorForStyle; return backgroundColor != ConsoleColor.Black ? ConsoleColor.Black : ConsoleColor.White; }
public override void WriteLine(ColorStyle style, string value) { if (this._colorEnabled) { using (new ColorConsole(style)) this.WriteLine(value); } else this.WriteLine(value); }
/// <summary> /// Writes the value with the specified style. /// </summary> /// <param name="style">The style.</param> /// <param name="value">The value.</param> public override void WriteLine(ColorStyle style, string value) { if (_colorEnabled) using (new ColorConsole(style)) { WriteLine(value); } else WriteLine(value); }
/// <summary> /// By using styles, we can keep everything consistent /// </summary> /// <param name="style"></param> /// <returns></returns> public static ConsoleColor GetColor(ColorStyle style) { ConsoleColor color = GetColorForStyle(style); ConsoleColor bg = Console.BackgroundColor; if (color == bg || color == ConsoleColor.Red && bg == ConsoleColor.Magenta) return bg == ConsoleColor.Black ? ConsoleColor.White : ConsoleColor.Black; return color; }
public void SetUp() { // Find a test color that is different than the console color if (Console.ForegroundColor != ColorConsole.GetColor( ColorStyle.Error )) _testStyle = ColorStyle.Error; else if (Console.ForegroundColor != ColorConsole.GetColor( ColorStyle.Pass )) _testStyle = ColorStyle.Pass; else Assert.Inconclusive("Could not find a color to test with"); // Set to an unknown, unlikely color so that we can test for change Console.ForegroundColor = ConsoleColor.Magenta; Assume.That(Console.ForegroundColor, Is.EqualTo(ConsoleColor.Magenta), "Color tests cannot be run because the current console does not support color"); }
public void AddStyle(ColorStyle style, float r, float g, float b, float a = 1.0f) { Vector4 color = new Vector4(r, g, b, a); AddStyle(style, color); }
public Style(ColorStyle style, uint color) { this.style = style; this.color = color; }
//ColorStyle public void AddStyle(ColorStyle style, uint color) { Style nodeStyle = new Style(style, color); m_StyleList.Add(nodeStyle); }
public static void ClearMain() { _currentlist.Clear(); _mainStyle.Cleanup(); _mainStyle = null; }
/// <summary> /// Writes the value with the specified style. /// </summary> /// <param name="style">The style.</param> /// <param name="value">The value.</param> public override void Write(ColorStyle style, string value) { _textBlock.Inlines.Add(new Run() { Text = value, Foreground = GetBrush(style) }); }
/// <summary> /// By using styles, we can keep everything consistent /// </summary> /// <param name="style"></param> /// <returns></returns> public static ConsoleColor GetColor(ColorStyle style) { switch (Console.BackgroundColor) { case ConsoleColor.White: switch (style) { case ColorStyle.Header: return ConsoleColor.DarkBlue; case ColorStyle.SubHeader: return ConsoleColor.DarkGray; case ColorStyle.SectionHeader: return ConsoleColor.DarkBlue; case ColorStyle.Label: return ConsoleColor.DarkGreen; case ColorStyle.Value: return ConsoleColor.Blue; case ColorStyle.Pass: return ConsoleColor.Green; case ColorStyle.Failure: return ConsoleColor.Red; case ColorStyle.Warning: return ConsoleColor.Yellow; case ColorStyle.Error: return ConsoleColor.Red; case ColorStyle.Output: return ConsoleColor.DarkGray; case ColorStyle.Help: return ConsoleColor.DarkGray; case ColorStyle.Default: default: return ConsoleColor.Green; } case ConsoleColor.Gray: switch (style) { case ColorStyle.Header: return ConsoleColor.White; case ColorStyle.SubHeader: return ConsoleColor.DarkGray; case ColorStyle.SectionHeader: return ConsoleColor.Cyan; case ColorStyle.Label: return ConsoleColor.Green; case ColorStyle.Value: return ConsoleColor.White; case ColorStyle.Pass: return ConsoleColor.Green; case ColorStyle.Failure: return ConsoleColor.Red; case ColorStyle.Warning: return ConsoleColor.Yellow; case ColorStyle.Error: return ConsoleColor.Red; case ColorStyle.Output: return ConsoleColor.DarkGray; case ColorStyle.Help: return ConsoleColor.DarkGray; case ColorStyle.Default: default: return ConsoleColor.Green; } default: switch (style) { case ColorStyle.Header: return ConsoleColor.White; case ColorStyle.SubHeader: return ConsoleColor.Gray; case ColorStyle.SectionHeader: return ConsoleColor.Cyan; case ColorStyle.Label: return ConsoleColor.Green; case ColorStyle.Value: return ConsoleColor.White; case ColorStyle.Pass: return ConsoleColor.Green; case ColorStyle.Failure: return ConsoleColor.Red; case ColorStyle.Warning: return ConsoleColor.Yellow; case ColorStyle.Error: return ConsoleColor.Red; case ColorStyle.Output: return ConsoleColor.Gray; case ColorStyle.Help: return ConsoleColor.Green; case ColorStyle.Default: default: return ConsoleColor.Green; } } }
/// <summary> /// Writes the value with the specified style /// </summary> /// <param name="style">The style.</param> /// <param name="value">The value.</param> public override void WriteLine(ColorStyle style, string value) { WriteLine(value); }
public void DrawNestedClassShape(string s, int x, int y, Dictionary<String, CaptionedShapeBase> dShape) { CircleBase shape = (CircleBase)_NShapeProject.ShapeTypes["Circle"].CreateInstance(); shape.Diameter = 100; shape.X = x; shape.Y = y; ColorStyle myColorStyle = new ColorStyle("test", System.Drawing.Color.Red); ColorStyle mySecondColorStyle = new ColorStyle("test", System.Drawing.Color.White); FillStyle myFillStyle = new FillStyle("test", myColorStyle, mySecondColorStyle); shape.FillStyle = myFillStyle; shape.SetCaptionText(0, s); _NShapeDiagram.Shapes.Add(shape); if (!dShape.ContainsKey(s)) dShape.Add(s, shape); }
/// <summary> /// By using styles, we can keep everything consistent /// </summary> /// <param name="style"></param> /// <returns></returns> public static ConsoleColor GetColor(ColorStyle style) { switch (Console.BackgroundColor) { case ConsoleColor.White: switch (style) { case ColorStyle.Header: return(ConsoleColor.DarkBlue); case ColorStyle.SubHeader: return(ConsoleColor.DarkGray); case ColorStyle.SectionHeader: return(ConsoleColor.DarkBlue); case ColorStyle.Label: return(ConsoleColor.DarkGreen); case ColorStyle.Value: return(ConsoleColor.Blue); case ColorStyle.Pass: return(ConsoleColor.Green); case ColorStyle.Failure: return(ConsoleColor.Red); case ColorStyle.Warning: return(ConsoleColor.Yellow); case ColorStyle.Error: return(ConsoleColor.Red); case ColorStyle.Output: return(ConsoleColor.DarkGray); case ColorStyle.Default: default: return(ConsoleColor.Green); } case ConsoleColor.Gray: switch (style) { case ColorStyle.Header: return(ConsoleColor.White); case ColorStyle.SubHeader: return(ConsoleColor.DarkGray); case ColorStyle.SectionHeader: return(ConsoleColor.Cyan); case ColorStyle.Label: return(ConsoleColor.Green); case ColorStyle.Value: return(ConsoleColor.White); case ColorStyle.Pass: return(ConsoleColor.Green); case ColorStyle.Failure: return(ConsoleColor.Red); case ColorStyle.Warning: return(ConsoleColor.Yellow); case ColorStyle.Error: return(ConsoleColor.Red); case ColorStyle.Output: return(ConsoleColor.DarkGray); case ColorStyle.Default: default: return(ConsoleColor.Green); } default: switch (style) { case ColorStyle.Header: return(ConsoleColor.White); case ColorStyle.SubHeader: return(ConsoleColor.Gray); case ColorStyle.SectionHeader: return(ConsoleColor.Cyan); case ColorStyle.Label: return(ConsoleColor.Green); case ColorStyle.Value: return(ConsoleColor.White); case ColorStyle.Pass: return(ConsoleColor.Green); case ColorStyle.Failure: return(ConsoleColor.Red); case ColorStyle.Warning: return(ConsoleColor.Yellow); case ColorStyle.Error: return(ConsoleColor.Red); case ColorStyle.Output: return(ConsoleColor.Gray); case ColorStyle.Default: default: return(ConsoleColor.Green); } } }
public contextcolors(ThemeStyle Theme, ColorStyle Style) { _theme = Theme; _style = Style; }
public static XNACOLOR ToXna(this ColorStyle c) { return(new XNACOLOR(c.R, c.G, c.B, c.A)); }
/// <summary> /// Writes the value with the specified style. /// </summary> /// <param name="style">The style.</param> /// <param name="value">The value.</param> public override void Write(ColorStyle style, string value) { Write(value); }
private SolidColorBrush GetBrush(ColorStyle style) { if ((int)style < 0 || (int)style > 11) style = ColorStyle.Default; return new SolidColorBrush(_colors[(int)style]); }
/// <summary> /// Writes the value with the specified style. /// </summary> /// <param name="style">The style.</param> /// <param name="value">The value.</param> public override void WriteLine(ColorStyle style, string value) { Write(style, value); WriteLine(); }
/// <summary> /// Writes the label and the option that goes with it followed by a new line. /// </summary> /// <param name="label">The label.</param> /// <param name="option">The option.</param> /// <param name="valueStyle">The color to display the value with</param> public abstract void WriteLabelLine(string label, object option, ColorStyle valueStyle);
private static VECTOR3 _Extrude(ICoreScene3D dc, ReadOnlySpan <PointNode> nodes, bool closed, int divisions, ColorStyle color, bool flipFaces) { Span <POINT3> aa = stackalloc POINT3[divisions]; Span <POINT3> bb = stackalloc POINT3[divisions]; var maixAxis = _GetMainAxis(nodes); if (closed) { var n = nodes[nodes.Length - 1]; n._FillSection(aa, divisions, maixAxis + n.Axis); // aa.Reverse(); } for (int s = 0; s < nodes.Length; ++s) { var n = nodes[s]; n._FillSection(bb, divisions, maixAxis + n.Axis); if (s > 0 || closed) { for (int i = 0; i < bb.Length; ++i) { var j = (i + 1) % bb.Length; if (flipFaces) { dc.DrawConvexSurface(POINT3.Array(aa[i], aa[j], bb[j], bb[i]), color); } else { dc.DrawConvexSurface(POINT3.Array(aa[j], aa[i], bb[i], bb[j]), color); } } } bb.CopyTo(aa); } return(maixAxis); }
public void TestGetColor( ColorStyle style, ConsoleColor expected ) { Assert.That(ColorConsole.GetColor(style), Is.EqualTo(expected)); }
/// <inheritdoc/> public void DrawConvexSurface(ReadOnlySpan <Point3> vertices, ColorStyle style) { _Check(); _Target.DrawConvexSurface(vertices, style); }
/// <summary> /// Writes the label and the option that goes with it and optionally writes a new line. /// </summary> /// <param name="label">The label.</param> /// <param name="option">The option.</param> /// <param name="valueStyle">The color to display the value with</param> public override void WriteLabel(string label, object option, ColorStyle valueStyle) { Write(ColorStyle.Label, label); Write(valueStyle, option.ToString()); }
public void TestGetColor(ColorStyle style, ConsoleColor expected) { Assert.That(ColorConsole.GetColor(style), Is.EqualTo(expected)); }
private void WriteSingleResult(XmlNode result, ColorStyle colorStyle) { string status = result.GetAttribute("label"); if (status == null) status = result.GetAttribute("result"); if (status == "Failed" || status == "Error") { var site = result.GetAttribute("site"); if (site == "SetUp" || site == "TearDown") status = site + " " + status; } string fullName = result.GetAttribute("fullname"); _writer.WriteLine(colorStyle, string.Format("{0}) {1} : {2}", ++_reportIndex, status, fullName)); XmlNode failureNode = result.SelectSingleNode("failure"); if (failureNode != null) { XmlNode message = failureNode.SelectSingleNode("message"); XmlNode stacktrace = failureNode.SelectSingleNode("stack-trace"); // In order to control the format, we trim any line-end chars // from end of the strings we write and supply them via calls // to WriteLine(). Newlines within the strings are retained. if (message != null) _writer.WriteLine(colorStyle, message.InnerText.TrimEnd(EOL_CHARS)); if (stacktrace != null) _writer.WriteLine(colorStyle, stacktrace.InnerText.TrimEnd(EOL_CHARS)); } XmlNode reasonNode = result.SelectSingleNode("reason"); if (reasonNode != null) { XmlNode message = reasonNode.SelectSingleNode("message"); if (message != null) _writer.WriteLine(colorStyle, message.InnerText.TrimEnd(EOL_CHARS)); } _writer.WriteLine(); // Skip after each item }
public static Button ClassicButton(IWidget parent, string text, int x, int y, ColorStyle style = ColorStyle.Default) { InitClassic(); const int kFontSize = 24; const float kBias = 1.0f; Button rv = null; switch (style) { case ColorStyle.Default: rv = new Button(parent, new VGPath(mClassicOutline, mClassicStrokeVGPaint, mClassicActiveVGPaintDefault), new VGPath(mClassicOutline, mClassicStrokeVGPaint, mClassicNormalVGPaintDefault)); break; case ColorStyle.Red: rv = new Button(parent, new VGPath(mClassicOutline, mClassicStrokeVGPaint, mClassicActiveVGPaintRed), new VGPath(mClassicOutline, mClassicStrokeVGPaint, mClassicNormalVGPaintRed)); break; case ColorStyle.Green: rv = new Button(parent, new VGPath(mClassicOutline, mClassicStrokeVGPaint, mClassicActiveVGPaintGreen), new VGPath(mClassicOutline, mClassicStrokeVGPaint, mClassicNormalVGPaintGreen)); break; } if (rv == null) { return(null); } SetText(rv, text, kFontSize, kBias); rv.Move(x, y); return(rv); }
/// <summary> /// Writes the label and the option that goes with it followed by a new line. /// </summary> /// <param name="label">The label.</param> /// <param name="option">The option.</param> /// <param name="valueStyle">The color to display the value with</param> public override void WriteLabelLine(string label, object option, ColorStyle valueStyle) { WriteLabel(label, option, valueStyle); WriteLine(); }
public override void Write(ColorStyle style, string value) => WriteCore(value);
/// <override></override> protected override void OnDrawItem(DrawItemEventArgs e) { if (maxItemTextWidth < 0) { UpdateMaxItemWidth(e.Graphics); } const int txtMargin = 4; itemBounds.X = e.Bounds.X + 3; itemBounds.Y = e.Bounds.Y + 1; itemBounds.Width = (e.Bounds.Right - 3) - (e.Bounds.X + 3); itemBounds.Height = (e.Bounds.Bottom - 1) - (e.Bounds.Y + 1); previewRect.X = itemBounds.X + margin; previewRect.Y = itemBounds.Y + margin; previewRect.Width = itemBounds.Width - Math.Max(maxItemTextWidth, itemBounds.Width / 4) - (2 * margin) - (2 * txtMargin); previewRect.Height = (itemBounds.Bottom - margin) - (itemBounds.Y + margin); labelLayoutRect.X = previewRect.Right + txtMargin; labelLayoutRect.Y = previewRect.Y; labelLayoutRect.Width = maxItemTextWidth; labelLayoutRect.Height = previewRect.Height; // Draw Item Background and Border e.Graphics.FillRectangle(ItemBackgroundBrush, itemBounds); if (itemBorderColor != Color.Transparent) { e.Graphics.DrawRectangle(ItemBorderPen, itemBounds); } // Draw Selection and/or Focus markers if ((e.State & DrawItemState.Selected) != 0) { e.Graphics.FillRectangle(ItemSelectedBrush, itemBounds); } if ((e.State & DrawItemState.Focus) != 0) { if (itemFocusedColor != Color.Transparent) { e.Graphics.FillRectangle(ItemFocusedBrush, itemBounds); } if (FocusBorderColor != Color.Transparent) { e.Graphics.DrawRectangle(FocusBorderPen, itemBounds); } } else if (HighlightItems && (e.State & DrawItemState.HotLight) != 0) { if (ItemHighlightedColor != Color.Transparent) { e.Graphics.FillRectangle(ItemHighlightedBrush, itemBounds); } } e.Graphics.SmoothingMode = SmoothingMode.HighQuality; e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; if (Items.Count > 0 && e.Index >= 0) { if (Items[e.Index] is IStyle) { switch (StyleCategory) { case StyleCategory.CapStyle: DrawCapStyleItem((CapStyle)Items[e.Index], e); break; case StyleCategory.ColorStyle: ColorStyle colorStyle = (ColorStyle)Items[e.Index]; Brush colorBrush = ToolCache.GetBrush(colorStyle); e.Graphics.FillRectangle(colorBrush, previewRect); e.Graphics.DrawRectangle(ItemBorderPen, previewRect); e.Graphics.DrawRectangle(Pens.Black, previewRect); e.Graphics.DrawString(colorStyle.Title, e.Font, TextBrush, labelLayoutRect, styleItemFormatter); break; case StyleCategory.FillStyle: DrawFillStyleItem((FillStyle)Items[e.Index], e); break; case StyleCategory.CharacterStyle: CharacterStyle charStyle = (CharacterStyle)Items[e.Index]; Font font = ToolCache.GetFont(charStyle); Brush fontBrush = ToolCache.GetBrush(charStyle.ColorStyle); e.Graphics.DrawString(string.Format("{0} {1} pt", font.FontFamily.Name, font.SizeInPoints), font, fontBrush, previewRect, styleItemFormatter); e.Graphics.DrawString(charStyle.Title, e.Font, TextBrush, labelLayoutRect, styleItemFormatter); break; case StyleCategory.LineStyle: LineStyle lineStyle = (LineStyle)Items[e.Index]; Pen linePen = ToolCache.GetPen(lineStyle, null, null); e.Graphics.DrawLine(linePen, previewRect.X, previewRect.Y + (previewRect.Height / 2), previewRect.Right, previewRect.Y + (previewRect.Height / 2)); e.Graphics.DrawString(lineStyle.Title, e.Font, TextBrush, labelLayoutRect, styleItemFormatter); break; case StyleCategory.ParagraphStyle: ParagraphStyle paragraphStyle = (ParagraphStyle)Items[e.Index]; StringFormat stringFormat = ToolCache.GetStringFormat(paragraphStyle); Rectangle r = Rectangle.Empty; r.X = previewRect.Left + paragraphStyle.Padding.Left; r.Y = previewRect.Top + paragraphStyle.Padding.Top; r.Width = previewRect.Width - (paragraphStyle.Padding.Left + paragraphStyle.Padding.Right); r.Height = previewRect.Height - (paragraphStyle.Padding.Top + paragraphStyle.Padding.Bottom); e.Graphics.DrawString(previewText, e.Font, TextBrush, r, stringFormat); e.Graphics.DrawRectangle(Pens.Black, previewRect); e.Graphics.DrawString(paragraphStyle.Title, e.Font, TextBrush, labelLayoutRect, styleItemFormatter); break; default: throw new NShapeException(string.Format("Unexpected enum value '{0}'.", styleCategory)); } } else { e.Graphics.DrawString(Items[e.Index].ToString().Trim(), e.Font, TextBrush, e.Bounds, specialItemFormatter); } } }
public override void WriteLabel(string label, object option, ColorStyle valueStyle) => WriteLabel(label, option);
public Style(ColorStyle colorStyle, uint color) { m_ColorStyle = colorStyle; m_Color = color; }
private void WriteLine(ColorStyle style, string text) { _outWriter.WriteLine(style, text); }
public void AddStyle(ColorStyle style, Vector4 color) { AddStyle(style, ImGui.GetColorU32(color)); }
private void WriteLabelLine(string label, object option, ColorStyle valueStyle) { _outWriter.WriteLabelLine(label, option, valueStyle); }
/// <summary> /// Writes the value with the specified style /// </summary> /// <param name="style">The style.</param> /// <param name="value">The value.</param> public abstract void WriteLine(ColorStyle style, string value);
public static void PushColorStyle(ColorStyle item, uint color) { imnodesNative.imnodes_PushColorStyle(item, color); }
public Color DrawColorMap(DATA ymin, DATA ymax, DATA y, ColorStyle style = ColorStyle.GRAY) { Color color = Color.White; switch (style) { case ColorStyle.HOT: if (cmapHot != null) { int colorLength = cmapHot.GetLength(0); int cindex = colorLength / 2 + (int)Math.Round(y / ((ymax - ymin) / colorLength)); if (cindex < 1) { cindex = 1; } if (cindex > colorLength) { cindex = colorLength; } color = Color.FromArgb(cmapHot[cindex - 1, 0], cmapHot[cindex - 1, 1], cmapHot[cindex - 1, 2], cmapHot[cindex - 1, 3]); } break; case ColorStyle.COLOR: if (cmapJet != null) { int colorLength = cmapJet.GetLength(0); int cindex = colorLength / 2 + (int)Math.Round(y / ((ymax - ymin) / colorLength)); if (cindex < 1) { cindex = 1; } if (cindex > colorLength) { cindex = colorLength; } color = Color.FromArgb(cmapJet[cindex - 1, 0], cmapJet[cindex - 1, 1], cmapJet[cindex - 1, 2], cmapJet[cindex - 1, 3]); } break; case ColorStyle.GRAY: if (cmapGray != null) { int colorLength = cmapGray.GetLength(0); int cindex = colorLength / 2 + (int)Math.Round(y / ((ymax - ymin) / colorLength)); if (cindex < 1) { cindex = 1; } if (cindex > colorLength) { cindex = colorLength; } color = Color.FromArgb(cmapGray[cindex - 1, 0], cmapGray[cindex - 1, 1], cmapGray[cindex - 1, 2], cmapGray[cindex - 1, 3]); } break; } return(color); }
/// <summary> /// Initializes a new instance of the <see cref="ColorConsole"/> class. /// </summary> /// <param name="style">The color style to use.</param> public ColorConsole(ColorStyle style) { #if !SILVERLIGHT && !NETCF Console.ForegroundColor = GetColor(style); #endif }
public ColorConsole(ColorStyle style) { this._originalColor = Console.ForegroundColor; Console.ForegroundColor = ColorConsole.GetColor(style); }
/// <summary> /// Initializes a new instance of the <see cref="ColorConsole"/> class. /// </summary> /// <param name="style">The color style to use.</param> public ColorConsole(ColorStyle style) { _originalColor = Console.ForegroundColor; Console.ForegroundColor = GetColor(style); }
private static ConsoleColor GetColorForStyle(ColorStyle style) { switch (Console.BackgroundColor) { case ConsoleColor.Green: case ConsoleColor.Cyan: case ConsoleColor.Red: case ConsoleColor.Magenta: case ConsoleColor.Yellow: switch (style) { case ColorStyle.Header: return ConsoleColor.Black; case ColorStyle.SubHeader: return ConsoleColor.Black; case ColorStyle.SectionHeader: return ConsoleColor.Blue; case ColorStyle.Output: return ConsoleColor.Black; case ColorStyle.Help: return ConsoleColor.Black; case ColorStyle.Label: return ConsoleColor.Black; case ColorStyle.Value: return ConsoleColor.Black; case ColorStyle.Pass: return ConsoleColor.Black; case ColorStyle.Failure: return ConsoleColor.Red; case ColorStyle.Warning: return ConsoleColor.Yellow; case ColorStyle.Error: return ConsoleColor.Red; default: return ConsoleColor.Black; } case ConsoleColor.White: switch (style) { case ColorStyle.Header: return ConsoleColor.Black; case ColorStyle.SubHeader: return ConsoleColor.Black; case ColorStyle.SectionHeader: return ConsoleColor.Blue; case ColorStyle.Output: return ConsoleColor.Black; case ColorStyle.Help: return ConsoleColor.Black; case ColorStyle.Label: return ConsoleColor.Black; case ColorStyle.Value: return ConsoleColor.Blue; case ColorStyle.Pass: return ConsoleColor.Green; case ColorStyle.Failure: return ConsoleColor.Red; case ColorStyle.Warning: return ConsoleColor.Black; case ColorStyle.Error: return ConsoleColor.Red; default: return ConsoleColor.Black; } default: switch (style) { case ColorStyle.Header: return ConsoleColor.White; case ColorStyle.SubHeader: return ConsoleColor.Gray; case ColorStyle.SectionHeader: return ConsoleColor.Cyan; case ColorStyle.Output: return ConsoleColor.Gray; case ColorStyle.Help: return ConsoleColor.Green; case ColorStyle.Label: return ConsoleColor.Green; case ColorStyle.Value: return ConsoleColor.White; case ColorStyle.Pass: return ConsoleColor.Green; case ColorStyle.Failure: return ConsoleColor.Red; case ColorStyle.Warning: return ConsoleColor.Yellow; case ColorStyle.Error: return ConsoleColor.Red; default: return ConsoleColor.Green; } } }
private static ConsoleColor GetColorForStyle(ColorStyle style) { switch (Console.BackgroundColor) { case ConsoleColor.White: switch (style) { case ColorStyle.Header: return(ConsoleColor.Black); case ColorStyle.SubHeader: return(ConsoleColor.Black); case ColorStyle.SectionHeader: return(ConsoleColor.Blue); case ColorStyle.Label: return(ConsoleColor.Black); case ColorStyle.Value: return(ConsoleColor.Blue); case ColorStyle.Pass: return(ConsoleColor.Green); case ColorStyle.Failure: return(ConsoleColor.Red); case ColorStyle.Warning: return(ConsoleColor.Black); case ColorStyle.Error: return(ConsoleColor.Red); case ColorStyle.Output: return(ConsoleColor.Black); case ColorStyle.Help: return(ConsoleColor.Black); case ColorStyle.Default: default: return(ConsoleColor.Black); } case ConsoleColor.Cyan: case ConsoleColor.Green: case ConsoleColor.Red: case ConsoleColor.Magenta: case ConsoleColor.Yellow: switch (style) { case ColorStyle.Header: return(ConsoleColor.Black); case ColorStyle.SubHeader: return(ConsoleColor.Black); case ColorStyle.SectionHeader: return(ConsoleColor.Blue); case ColorStyle.Label: return(ConsoleColor.Black); case ColorStyle.Value: return(ConsoleColor.Black); case ColorStyle.Pass: return(ConsoleColor.Black); case ColorStyle.Failure: return(ConsoleColor.Red); case ColorStyle.Warning: return(ConsoleColor.Yellow); case ColorStyle.Error: return(ConsoleColor.Red); case ColorStyle.Output: return(ConsoleColor.Black); case ColorStyle.Help: return(ConsoleColor.Black); case ColorStyle.Default: default: return(ConsoleColor.Black); } default: switch (style) { case ColorStyle.Header: return(ConsoleColor.White); case ColorStyle.SubHeader: return(ConsoleColor.Gray); case ColorStyle.SectionHeader: return(ConsoleColor.Cyan); case ColorStyle.Label: return(ConsoleColor.Green); case ColorStyle.Value: return(ConsoleColor.White); case ColorStyle.Pass: return(ConsoleColor.Green); case ColorStyle.Failure: return(ConsoleColor.Red); case ColorStyle.Warning: return(ConsoleColor.Yellow); case ColorStyle.Error: return(ConsoleColor.Red); case ColorStyle.Output: return(ConsoleColor.Gray); case ColorStyle.Help: return(ConsoleColor.Green); case ColorStyle.Default: default: return(ConsoleColor.Green); } } }
private void WriteSummaryCount(string label, int count, ColorStyle color) { Writer.WriteLabel(label, count.ToString(CultureInfo.CurrentUICulture), count > 0 ? color : ColorStyle.Value); }
/// <summary> /// Writes the value with the specified style /// </summary> /// <param name="style">The style.</param> /// <param name="value">The value.</param> public abstract void WriteLine(ColorStyle style, string value);
/// <summary> /// Writes the label and the option that goes with it followed by a new line. /// </summary> /// <param name="label">The label.</param> /// <param name="option">The option.</param> /// <param name="valueStyle">The color to display the value with</param> public override void WriteLabelLine(string label, object option, ColorStyle valueStyle) { WriteLabelLine(label, option); }
public XPanel() { PC1 = Color.White; PC2 = SystemColors.ButtonFace; this.CS = ColorStyle.CSFull; this.Paint += new PaintEventHandler(XPanel_Paint); }
public static void CreateMainStyle() { if (_mainStyle == null) { _mainStyle = new ColorStyle(); } }
private void WriteLine(ColorStyle style, string text) { _outWriter.WriteLine(style, text); }
/// <summary> /// Writes the label and the option that goes with it and optionally writes a new line. /// </summary> /// <param name="label">The label.</param> /// <param name="option">The option.</param> /// <param name="valueStyle">The color to display the value with</param> public override void WriteLabel(string label, object option, ColorStyle valueStyle) { Write(ColorStyle.Label, label); Write(valueStyle, option.ToString()); }
private void Main_Designer_Load(object sender, EventArgs e) { WriteConfigLabel(); project.AddLibraryByName("Dataweb.NShape.GeneralShapes", false); project.AddLibraryByName("Dataweb.NShape.SoftwareArchitectureShapes", false); project.Name = "DesigningProject"; project.Create(); toolBoxAdapter.ToolSetController.Clear(); toolBoxAdapter.ToolSetController.AddTool(new SelectionTool(), true); toolBoxAdapter.ToolSetController.SelectedTool = toolBoxAdapter.ToolSetController.DefaultTool; diagramTab = new Diagram(string.Format("Diagramma Tabelle")) { Width = 6000, Height = 6000, BackgroundGradientColor = Color.WhiteSmoke }; ColorStyle colorStyleBlack = new ColorStyle("colorStyleBlack", Color.Black); ColorStyle colorStyleDarkRed = new ColorStyle("colorStyleDarkRed", Color.DarkRed); CharacterStyle charStyleLabel = new CharacterStyle("LabelStyle", 16, colorStyleBlack); CharacterStyle charStyleLabelNotGenerated = new CharacterStyle("LabelStyleNotGen", 16, colorStyleDarkRed); LineStyle relGenerated = new LineStyle("RelGenerated", 2, colorStyleBlack); LineStyle relNotGenerated = new LineStyle("RelNotGenerated", 2, colorStyleDarkRed); project.Design.AddStyle(colorStyleBlack); project.Repository.Insert(project.Design, colorStyleBlack); project.Design.AddStyle(colorStyleDarkRed); project.Repository.Insert(project.Design, colorStyleDarkRed); project.Design.AddStyle(charStyleLabel); project.Repository.Insert(project.Design, charStyleLabel); project.Design.AddStyle(charStyleLabelNotGenerated); project.Repository.Insert(project.Design, charStyleLabelNotGenerated); project.Design.AddStyle(relGenerated); project.Repository.Insert(project.Design, relGenerated); project.Design.AddStyle(relNotGenerated); project.Repository.Insert(project.Design, relNotGenerated); GraphicHelper = new GraphicHelper(cachedRepository, project, diagramTab, dspTables); GraphicHelper.SetDefaultShapes(project.ShapeTypes["Entity"], project.ShapeTypes["RectangularLine"], project.ShapeTypes["Label"]); InitBoard(); }
private void WriteOutputLine(string text, ColorStyle color) { using (new ColorConsole(color)) { _outWriter.Write(text); // Some labels were being shown on the same line as the previous output if (!text.EndsWith("\n")) { _outWriter.WriteLine(); } } }
public void DrawRelationNested(string class1Name, string class2Name, Dictionary<string, CaptionedShapeBase> shapeDictionary) { if (!shapeDictionary.ContainsKey(class1Name)) { MainForm.LogOnDebug("DrawRelation: Departing class missing from dictionary: " + class1Name); return; } if (!shapeDictionary.ContainsKey(class2Name)) { MainForm.LogOnDebug("DrawRelation: Arrival class missing from dictionary: " + class2Name); return; } LineShapeBase line = (LineShapeBase)_NShapeProject.ShapeTypes["Polyline"].CreateInstance(); ThickArrow arrow = (ThickArrow)_NShapeProject.ShapeTypes["ThickArrow"].CreateInstance(); line.Connect(ControlPointId.FirstVertex, shapeDictionary[class1Name], ControlPointId.Reference); line.Connect(ControlPointId.LastVertex, shapeDictionary[class2Name], ControlPointId.Reference); ColorStyle myColorStyle = new ColorStyle("test", System.Drawing.Color.Red); ColorStyle mySecondColorStyle = new ColorStyle("test", System.Drawing.Color.White); FillStyle myFillStyle = new FillStyle("test", myColorStyle, mySecondColorStyle); arrow.FillStyle = myFillStyle; arrow.MoveControlPointTo(1, line.GetControlPointPosition(ControlPointId.FirstVertex).X, line.GetControlPointPosition(ControlPointId.FirstVertex).Y, 0); arrow.MoveControlPointTo(6, line.GetControlPointPosition(ControlPointId.LastVertex).X, line.GetControlPointPosition(ControlPointId.LastVertex).Y, 0); _NShapeDiagram.Shapes.Add(arrow); }
/// <summary> /// Writes the label and the option that goes with it followed by a new line. /// </summary> /// <param name="label">The label.</param> /// <param name="option">The option.</param> /// <param name="valueStyle">The color to display the value with</param> public abstract void WriteLabelLine(string label, object option, ColorStyle valueStyle);
/// <summary> /// Writes the label and the option that goes with it. /// </summary> /// <param name="label">The label.</param> /// <param name="option">The option.</param> /// <param name="valueStyle">The color to display the value with</param> public abstract void WriteLabel(string label, object option, ColorStyle valueStyle = ColorStyle.Value);
private void WriteSummaryCount(string label, int count, ColorStyle color) { _outWriter.WriteLabel(label, count.ToString(CultureInfo.CurrentUICulture), count > 0 ? color : ColorStyle.Value); }
private void WriteLabelLine(string label, object option, ColorStyle color = ColorStyle.Value) { _writer.WriteLabelLine(label, option, color); }
private void WriteLabelLine(string label, object option, ColorStyle valueStyle) { _outWriter.WriteLabelLine(label, option, valueStyle); }
/// <summary> /// Writes the value with the specified style. /// </summary> /// <param name="style">The style.</param> /// <param name="value">The value.</param> public static void Write(ColorStyle style, string value) { using (new ColorConsole(style)) { Console.Write(value); } }