Border.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721
  1. namespace Terminal.Gui;
  2. /// <summary>The Border for a <see cref="View"/>.</summary>
  3. /// <remarks>
  4. /// <para>
  5. /// Renders a border around the view with the <see cref="View.Title"/>. A border using <see cref="LineStyle"/>
  6. /// will be drawn on the sides of <see cref="Thickness"/> that are greater than zero.
  7. /// </para>
  8. /// <para>
  9. /// The <see cref="View.Title"/> of <see cref="Adornment.Parent"/> will be drawn based on the value of
  10. /// <see cref="Thickness.Top"/>:
  11. /// </para>
  12. /// <para>
  13. /// If <c>1</c>:
  14. /// <code>
  15. /// ┌┤1234├──┐
  16. /// │ │
  17. /// └────────┘
  18. /// </code>
  19. /// </para>
  20. /// <para>
  21. /// If <c>2</c>:
  22. /// <code>
  23. /// ┌────┐
  24. /// ┌┤1234├──┐
  25. /// │ │
  26. /// └────────┘
  27. /// </code>
  28. /// </para>
  29. /// <para>
  30. /// If <c>3</c>:
  31. /// <code>
  32. /// ┌────┐
  33. /// ┌┤1234├──┐
  34. /// │└────┘ │
  35. /// │ │
  36. /// └────────┘
  37. /// </code>
  38. /// </para>
  39. /// <para/>
  40. /// <para>See the <see cref="Adornment"/> class.</para>
  41. /// </remarks>
  42. public class Border : Adornment
  43. {
  44. private LineStyle? _lineStyle;
  45. /// <inheritdoc/>
  46. public Border ()
  47. { /* Do nothing; A parameter-less constructor is required to support all views unit tests. */
  48. }
  49. /// <inheritdoc/>
  50. public Border (View parent) : base (parent)
  51. {
  52. /* Do nothing; View.CreateAdornment requires a constructor that takes a parent */
  53. Parent = parent;
  54. Application.GrabbingMouse += Application_GrabbingMouse;
  55. Application.UnGrabbingMouse += Application_UnGrabbingMouse;
  56. HighlightStyle |= HighlightStyle.Pressed;
  57. Highlight += Border_Highlight;
  58. }
  59. #if SUBVIEW_BASED_BORDER
  60. private Line _left;
  61. /// <summary>
  62. /// The close button for the border. Set to <see cref="View.Visible"/>, to <see langword="true"/> to enable.
  63. /// </summary>
  64. public Button CloseButton { get; internal set; }
  65. #endif
  66. /// <inheritdoc/>
  67. public override void BeginInit ()
  68. {
  69. #if HOVER
  70. // TOOD: Hack - make Arrangement overridable
  71. if ((Parent?.Arrangement & ViewArrangement.Movable) != 0)
  72. {
  73. HighlightStyle |= HighlightStyle.Hover;
  74. }
  75. #endif
  76. base.BeginInit ();
  77. #if SUBVIEW_BASED_BORDER
  78. if (Parent is { })
  79. {
  80. // Left
  81. _left = new ()
  82. {
  83. Orientation = Orientation.Vertical,
  84. };
  85. Add (_left);
  86. CloseButton = new Button ()
  87. {
  88. Text = "X",
  89. CanFocus = true,
  90. Visible = false,
  91. };
  92. CloseButton.Accept += (s, e) =>
  93. {
  94. e.Cancel = Parent.InvokeCommand (Command.QuitToplevel) == true;
  95. };
  96. Add (CloseButton);
  97. LayoutStarted += OnLayoutStarted;
  98. }
  99. #endif
  100. }
  101. #if SUBVIEW_BASED_BORDER
  102. private void OnLayoutStarted (object sender, LayoutEventArgs e)
  103. {
  104. _left.Border.LineStyle = LineStyle;
  105. _left.X = Thickness.Left - 1;
  106. _left.Y = Thickness.Top - 1;
  107. _left.Width = 1;
  108. _left.Height = Height;
  109. CloseButton.X = Pos.AnchorEnd (Thickness.Right / 2 + 1) -
  110. (Pos.Right (CloseButton) -
  111. Pos.Left (CloseButton));
  112. CloseButton.Y = 0;
  113. }
  114. #endif
  115. /// <summary>
  116. /// The color scheme for the Border. If set to <see langword="null"/>, gets the <see cref="Adornment.Parent"/>
  117. /// scheme. color scheme.
  118. /// </summary>
  119. public override ColorScheme ColorScheme
  120. {
  121. get
  122. {
  123. if (base.ColorScheme is { })
  124. {
  125. return base.ColorScheme;
  126. }
  127. return Parent?.ColorScheme;
  128. }
  129. set
  130. {
  131. base.ColorScheme = value;
  132. Parent?.SetNeedsDisplay ();
  133. }
  134. }
  135. internal Rectangle GetBorderRectangle ()
  136. {
  137. Rectangle screenRect = ViewportToScreen (Viewport);
  138. return new (
  139. screenRect.X + Math.Max (0, Thickness.Left - 1),
  140. screenRect.Y + Math.Max (0, Thickness.Top - 1),
  141. Math.Max (
  142. 0,
  143. screenRect.Width
  144. - Math.Max (
  145. 0,
  146. Math.Max (0, Thickness.Left - 1)
  147. + Math.Max (0, Thickness.Right - 1)
  148. )
  149. ),
  150. Math.Max (
  151. 0,
  152. screenRect.Height
  153. - Math.Max (
  154. 0,
  155. Math.Max (0, Thickness.Top - 1)
  156. + Math.Max (0, Thickness.Bottom - 1)
  157. )
  158. )
  159. );
  160. }
  161. /// <summary>
  162. /// Sets the style of the border by changing the <see cref="Thickness"/>. This is a helper API for setting the
  163. /// <see cref="Thickness"/> to <c>(1,1,1,1)</c> and setting the line style of the views that comprise the border. If
  164. /// set to <see cref="LineStyle.None"/> no border will be drawn.
  165. /// </summary>
  166. public LineStyle LineStyle
  167. {
  168. get
  169. {
  170. if (_lineStyle.HasValue)
  171. {
  172. return _lineStyle.Value;
  173. }
  174. // TODO: Make Border.LineStyle inherit from the SuperView hierarchy
  175. // TODO: Right now, Window and FrameView use CM to set BorderStyle, which negates
  176. // TODO: all this.
  177. return Parent.SuperView?.BorderStyle ?? LineStyle.None;
  178. }
  179. set => _lineStyle = value;
  180. }
  181. private BorderSettings _settings = BorderSettings.Title;
  182. /// <summary>
  183. /// Gets or sets the settings for the border.
  184. /// </summary>
  185. public BorderSettings Settings
  186. {
  187. get => _settings;
  188. set
  189. {
  190. if (value == _settings)
  191. {
  192. return;
  193. }
  194. _settings = value;
  195. Parent?.SetNeedsDisplay ();
  196. }
  197. }
  198. #region Mouse Support
  199. private Color? _savedForeColor;
  200. private void Border_Highlight (object sender, CancelEventArgs<HighlightStyle> e)
  201. {
  202. if (!Parent.Arrangement.HasFlag (ViewArrangement.Movable))
  203. {
  204. e.Cancel = true;
  205. return;
  206. }
  207. if (e.NewValue.HasFlag (HighlightStyle.Pressed))
  208. {
  209. if (!_savedForeColor.HasValue)
  210. {
  211. _savedForeColor = ColorScheme.Normal.Foreground;
  212. }
  213. var cs = new ColorScheme (ColorScheme)
  214. {
  215. Normal = new (ColorScheme.Normal.Foreground.GetHighlightColor (), ColorScheme.Normal.Background)
  216. };
  217. ColorScheme = cs;
  218. }
  219. #if HOVER
  220. else if (e.HighlightStyle.HasFlag (HighlightStyle.Hover))
  221. {
  222. if (!_savedHighlightLineStyle.HasValue)
  223. {
  224. _savedHighlightLineStyle = Parent?.BorderStyle ?? LineStyle;
  225. }
  226. LineStyle = LineStyle.Double;
  227. }
  228. #endif
  229. if (e.NewValue == HighlightStyle.None && _savedForeColor.HasValue)
  230. {
  231. var cs = new ColorScheme (ColorScheme)
  232. {
  233. Normal = new (_savedForeColor.Value, ColorScheme.Normal.Background)
  234. };
  235. ColorScheme = cs;
  236. }
  237. Parent?.SetNeedsDisplay ();
  238. e.Cancel = true;
  239. }
  240. private Point? _dragPosition;
  241. private Point _startGrabPoint;
  242. /// <inheritdoc/>
  243. protected internal override bool OnMouseEvent (MouseEvent mouseEvent)
  244. {
  245. if (base.OnMouseEvent (mouseEvent))
  246. {
  247. return true;
  248. }
  249. // BUGBUG: Shouldn't non-focusable views be draggable??
  250. //if (!Parent.CanFocus)
  251. //{
  252. // return false;
  253. //}
  254. if (!Parent.Arrangement.HasFlag (ViewArrangement.Movable))
  255. {
  256. return false;
  257. }
  258. // BUGBUG: See https://github.com/gui-cs/Terminal.Gui/issues/3312
  259. if (!_dragPosition.HasValue && mouseEvent.Flags.HasFlag (MouseFlags.Button1Pressed))
  260. {
  261. Parent.SetFocus ();
  262. ApplicationOverlapped.BringOverlappedTopToFront ();
  263. // Only start grabbing if the user clicks in the Thickness area
  264. // Adornment.Contains takes Parent SuperView=relative coords.
  265. if (Contains (new (mouseEvent.Position.X + Parent.Frame.X + Frame.X, mouseEvent.Position.Y + Parent.Frame.Y + Frame.Y)))
  266. {
  267. // Set the start grab point to the Frame coords
  268. _startGrabPoint = new (mouseEvent.Position.X + Frame.X, mouseEvent.Position.Y + Frame.Y);
  269. _dragPosition = mouseEvent.Position;
  270. Application.GrabMouse (this);
  271. SetHighlight (HighlightStyle);
  272. }
  273. return true;
  274. }
  275. if (mouseEvent.Flags is (MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition))
  276. {
  277. if (Application.MouseGrabView == this && _dragPosition.HasValue)
  278. {
  279. if (Parent.SuperView is null)
  280. {
  281. // Redraw the entire app window.
  282. Application.Top.SetNeedsDisplay ();
  283. }
  284. else
  285. {
  286. Parent.SuperView.SetNeedsDisplay ();
  287. }
  288. _dragPosition = mouseEvent.Position;
  289. Point parentLoc = Parent.SuperView?.ScreenToViewport (new (mouseEvent.ScreenPosition.X, mouseEvent.ScreenPosition.Y))
  290. ?? mouseEvent.ScreenPosition;
  291. GetLocationEnsuringFullVisibility (
  292. Parent,
  293. parentLoc.X - _startGrabPoint.X,
  294. parentLoc.Y - _startGrabPoint.Y,
  295. out int nx,
  296. out int ny,
  297. out _
  298. );
  299. Parent.X = nx;
  300. Parent.Y = ny;
  301. return true;
  302. }
  303. }
  304. if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Released) && _dragPosition.HasValue)
  305. {
  306. _dragPosition = null;
  307. Application.UngrabMouse ();
  308. SetHighlight (HighlightStyle.None);
  309. return true;
  310. }
  311. return false;
  312. }
  313. /// <inheritdoc/>
  314. protected override void Dispose (bool disposing)
  315. {
  316. Application.GrabbingMouse -= Application_GrabbingMouse;
  317. Application.UnGrabbingMouse -= Application_UnGrabbingMouse;
  318. _dragPosition = null;
  319. base.Dispose (disposing);
  320. }
  321. private void Application_GrabbingMouse (object sender, GrabMouseEventArgs e)
  322. {
  323. if (Application.MouseGrabView == this && _dragPosition.HasValue)
  324. {
  325. e.Cancel = true;
  326. }
  327. }
  328. private void Application_UnGrabbingMouse (object sender, GrabMouseEventArgs e)
  329. {
  330. if (Application.MouseGrabView == this && _dragPosition.HasValue)
  331. {
  332. e.Cancel = true;
  333. }
  334. }
  335. #endregion Mouse Support
  336. /// <inheritdoc/>
  337. public override void OnDrawContent (Rectangle viewport)
  338. {
  339. base.OnDrawContent (viewport);
  340. if (Thickness == Thickness.Empty)
  341. {
  342. return;
  343. }
  344. //Driver.SetAttribute (Colors.ColorSchemes ["Error"].Normal);
  345. Rectangle screenBounds = ViewportToScreen (viewport);
  346. //OnDrawSubviews (bounds);
  347. // TODO: v2 - this will eventually be two controls: "BorderView" and "Label" (for the title)
  348. // The border adornment (and title) are drawn at the outermost edge of border;
  349. // For Border
  350. // ...thickness extends outward (border/title is always as far in as possible)
  351. // PERF: How about a call to Rectangle.Offset?
  352. Rectangle borderBounds = GetBorderRectangle ();
  353. int topTitleLineY = borderBounds.Y;
  354. int titleY = borderBounds.Y;
  355. var titleBarsLength = 0; // the little vertical thingies
  356. int maxTitleWidth = Math.Max (
  357. 0,
  358. Math.Min (
  359. Parent.TitleTextFormatter.FormatAndGetSize ().Width,
  360. Math.Min (screenBounds.Width - 4, borderBounds.Width - 4)
  361. )
  362. );
  363. Parent.TitleTextFormatter.ConstrainToSize = new (maxTitleWidth, 1);
  364. int sideLineLength = borderBounds.Height;
  365. bool canDrawBorder = borderBounds is { Width: > 0, Height: > 0 };
  366. if (Settings.FastHasFlags (BorderSettings.Title))
  367. {
  368. if (Thickness.Top == 2)
  369. {
  370. topTitleLineY = borderBounds.Y - 1;
  371. titleY = topTitleLineY + 1;
  372. titleBarsLength = 2;
  373. }
  374. // ┌────┐
  375. //┌┘View└
  376. //│
  377. if (Thickness.Top == 3)
  378. {
  379. topTitleLineY = borderBounds.Y - (Thickness.Top - 1);
  380. titleY = topTitleLineY + 1;
  381. titleBarsLength = 3;
  382. sideLineLength++;
  383. }
  384. // ┌────┐
  385. //┌┘View└
  386. //│
  387. if (Thickness.Top > 3)
  388. {
  389. topTitleLineY = borderBounds.Y - 2;
  390. titleY = topTitleLineY + 1;
  391. titleBarsLength = 3;
  392. sideLineLength++;
  393. }
  394. }
  395. if (canDrawBorder && Thickness.Top > 0 && maxTitleWidth > 0 && Settings.FastHasFlags (BorderSettings.Title) && !string.IsNullOrEmpty (Parent?.Title))
  396. {
  397. Attribute focus = Parent.GetNormalColor ();
  398. if (Parent.SuperView is { } && Parent.SuperView?.Subviews!.Count (s => s.CanFocus) > 1)
  399. {
  400. // Only use focus color if there are multiple focusable views
  401. focus = Parent.GetFocusColor ();
  402. }
  403. Parent.TitleTextFormatter.Draw (
  404. new (borderBounds.X + 2, titleY, maxTitleWidth, 1),
  405. Parent.HasFocus ? focus : Parent.GetNormalColor (),
  406. Parent.HasFocus ? focus : Parent.GetHotNormalColor ());
  407. }
  408. if (canDrawBorder && LineStyle != LineStyle.None)
  409. {
  410. LineCanvas lc = Parent?.LineCanvas;
  411. bool drawTop = Thickness.Top > 0 && Frame.Width > 1 && Frame.Height >= 1;
  412. bool drawLeft = Thickness.Left > 0 && (Frame.Height > 1 || Thickness.Top == 0);
  413. bool drawBottom = Thickness.Bottom > 0 && Frame.Width > 1 && Frame.Height > 1;
  414. bool drawRight = Thickness.Right > 0 && (Frame.Height > 1 || Thickness.Top == 0);
  415. Attribute prevAttr = Driver.GetAttribute ();
  416. if (ColorScheme is { })
  417. {
  418. Driver.SetAttribute (GetNormalColor ());
  419. }
  420. else
  421. {
  422. Driver.SetAttribute (Parent.GetNormalColor ());
  423. }
  424. if (drawTop)
  425. {
  426. // ╔╡Title╞═════╗
  427. // ╔╡╞═════╗
  428. if (borderBounds.Width < 4 || !Settings.FastHasFlags (BorderSettings.Title) || string.IsNullOrEmpty (Parent?.Title))
  429. {
  430. // ╔╡╞╗ should be ╔══╗
  431. lc.AddLine (
  432. new (borderBounds.Location.X, titleY),
  433. borderBounds.Width,
  434. Orientation.Horizontal,
  435. LineStyle,
  436. Driver.GetAttribute ()
  437. );
  438. }
  439. else
  440. {
  441. // ┌────┐
  442. //┌┘View└
  443. //│
  444. if (Thickness.Top == 2)
  445. {
  446. lc.AddLine (
  447. new (borderBounds.X + 1, topTitleLineY),
  448. Math.Min (borderBounds.Width - 2, maxTitleWidth + 2),
  449. Orientation.Horizontal,
  450. LineStyle,
  451. Driver.GetAttribute ()
  452. );
  453. }
  454. // ┌────┐
  455. //┌┘View└
  456. //│
  457. if (borderBounds.Width >= 4 && Thickness.Top > 2)
  458. {
  459. lc.AddLine (
  460. new (borderBounds.X + 1, topTitleLineY),
  461. Math.Min (borderBounds.Width - 2, maxTitleWidth + 2),
  462. Orientation.Horizontal,
  463. LineStyle,
  464. Driver.GetAttribute ()
  465. );
  466. lc.AddLine (
  467. new (borderBounds.X + 1, topTitleLineY + 2),
  468. Math.Min (borderBounds.Width - 2, maxTitleWidth + 2),
  469. Orientation.Horizontal,
  470. LineStyle,
  471. Driver.GetAttribute ()
  472. );
  473. }
  474. // ╔╡Title╞═════╗
  475. // Add a short horiz line for ╔╡
  476. lc.AddLine (
  477. new (borderBounds.Location.X, titleY),
  478. 2,
  479. Orientation.Horizontal,
  480. LineStyle,
  481. Driver.GetAttribute ()
  482. );
  483. // Add a vert line for ╔╡
  484. lc.AddLine (
  485. new (borderBounds.X + 1, topTitleLineY),
  486. titleBarsLength,
  487. Orientation.Vertical,
  488. LineStyle.Single,
  489. Driver.GetAttribute ()
  490. );
  491. // Add a vert line for ╞
  492. lc.AddLine (
  493. new (
  494. borderBounds.X
  495. + 1
  496. + Math.Min (borderBounds.Width - 2, maxTitleWidth + 2)
  497. - 1,
  498. topTitleLineY
  499. ),
  500. titleBarsLength,
  501. Orientation.Vertical,
  502. LineStyle.Single,
  503. Driver.GetAttribute ()
  504. );
  505. // Add the right hand line for ╞═════╗
  506. lc.AddLine (
  507. new (
  508. borderBounds.X
  509. + 1
  510. + Math.Min (borderBounds.Width - 2, maxTitleWidth + 2)
  511. - 1,
  512. titleY
  513. ),
  514. borderBounds.Width - Math.Min (borderBounds.Width - 2, maxTitleWidth + 2),
  515. Orientation.Horizontal,
  516. LineStyle,
  517. Driver.GetAttribute ()
  518. );
  519. }
  520. }
  521. #if !SUBVIEW_BASED_BORDER
  522. if (drawLeft)
  523. {
  524. lc.AddLine (
  525. new (borderBounds.Location.X, titleY),
  526. sideLineLength,
  527. Orientation.Vertical,
  528. LineStyle,
  529. Driver.GetAttribute ()
  530. );
  531. }
  532. #endif
  533. if (drawBottom)
  534. {
  535. lc.AddLine (
  536. new (borderBounds.X, borderBounds.Y + borderBounds.Height - 1),
  537. borderBounds.Width,
  538. Orientation.Horizontal,
  539. LineStyle,
  540. Driver.GetAttribute ()
  541. );
  542. }
  543. if (drawRight)
  544. {
  545. lc.AddLine (
  546. new (borderBounds.X + borderBounds.Width - 1, titleY),
  547. sideLineLength,
  548. Orientation.Vertical,
  549. LineStyle,
  550. Driver.GetAttribute ()
  551. );
  552. }
  553. Driver.SetAttribute (prevAttr);
  554. // TODO: This should be moved to LineCanvas as a new BorderStyle.Ruler
  555. if (Diagnostics.HasFlag (ViewDiagnosticFlags.Ruler))
  556. {
  557. // Top
  558. var hruler = new Ruler { Length = screenBounds.Width, Orientation = Orientation.Horizontal };
  559. if (drawTop)
  560. {
  561. hruler.Draw (new (screenBounds.X, screenBounds.Y));
  562. }
  563. // Redraw title
  564. if (drawTop && maxTitleWidth > 0 && Settings.FastHasFlags (BorderSettings.Title))
  565. {
  566. Parent.TitleTextFormatter.Draw (
  567. new (borderBounds.X + 2, titleY, maxTitleWidth, 1),
  568. Parent.HasFocus ? Parent.GetFocusColor () : Parent.GetNormalColor (),
  569. Parent.HasFocus ? Parent.GetFocusColor () : Parent.GetNormalColor ());
  570. }
  571. //Left
  572. var vruler = new Ruler { Length = screenBounds.Height - 2, Orientation = Orientation.Vertical };
  573. if (drawLeft)
  574. {
  575. vruler.Draw (new (screenBounds.X, screenBounds.Y + 1), 1);
  576. }
  577. // Bottom
  578. if (drawBottom)
  579. {
  580. hruler.Draw (new (screenBounds.X, screenBounds.Y + screenBounds.Height - 1));
  581. }
  582. // Right
  583. if (drawRight)
  584. {
  585. vruler.Draw (new (screenBounds.X + screenBounds.Width - 1, screenBounds.Y + 1), 1);
  586. }
  587. }
  588. // TODO: This should not be done on each draw?
  589. if (Settings.FastHasFlags (BorderSettings.Gradient))
  590. {
  591. SetupGradientLineCanvas (lc, screenBounds);
  592. }
  593. else
  594. {
  595. lc.Fill = null;
  596. }
  597. }
  598. }
  599. private void SetupGradientLineCanvas (LineCanvas lc, Rectangle rect)
  600. {
  601. GetAppealingGradientColors (out List<Color> stops, out List<int> steps);
  602. var g = new Gradient (stops, steps);
  603. var fore = new GradientFill (rect, g, GradientDirection.Diagonal);
  604. var back = new SolidFill (GetNormalColor ().Background);
  605. lc.Fill = new (fore, back);
  606. }
  607. private static void GetAppealingGradientColors (out List<Color> stops, out List<int> steps)
  608. {
  609. // Define the colors of the gradient stops with more appealing colors
  610. stops = new()
  611. {
  612. new (0, 128, 255), // Bright Blue
  613. new (0, 255, 128), // Bright Green
  614. new (255, 255), // Bright Yellow
  615. new (255, 128), // Bright Orange
  616. new (255, 0, 128) // Bright Pink
  617. };
  618. // Define the number of steps between each color for smoother transitions
  619. // If we pass only a single value then it will assume equal steps between all pairs
  620. steps = new() { 15 };
  621. }
  622. }