ConsoleDriver.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. //
  2. // Driver.cs: Definition for the Console Driver API
  3. //
  4. // Authors:
  5. // Miguel de Icaza ([email protected])
  6. //
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Runtime.CompilerServices;
  10. using System.Runtime.InteropServices;
  11. using Mono.Terminal;
  12. using NStack;
  13. using Unix.Terminal;
  14. namespace Terminal.Gui {
  15. /// <summary>
  16. /// Basic colors that can be used to set the foreground and background colors in console applications. These can only be
  17. /// </summary>
  18. public enum Color {
  19. /// <summary>
  20. /// The black color.
  21. /// </summary>
  22. Black,
  23. /// <summary>
  24. /// The blue color.
  25. /// </summary>
  26. Blue,
  27. /// <summary>
  28. /// The green color.
  29. /// </summary>
  30. Green,
  31. /// <summary>
  32. /// The cyan color.
  33. /// </summary>
  34. Cyan,
  35. /// <summary>
  36. /// The red color.
  37. /// </summary>
  38. Red,
  39. /// <summary>
  40. /// The magenta color.
  41. /// </summary>
  42. Magenta,
  43. /// <summary>
  44. /// The brown color.
  45. /// </summary>
  46. Brown,
  47. /// <summary>
  48. /// The gray color.
  49. /// </summary>
  50. Gray,
  51. /// <summary>
  52. /// The dark gray color.
  53. /// </summary>
  54. DarkGray,
  55. /// <summary>
  56. /// The bright bBlue color.
  57. /// </summary>
  58. BrightBlue,
  59. /// <summary>
  60. /// The bright green color.
  61. /// </summary>
  62. BrightGreen,
  63. /// <summary>
  64. /// The brigh cyan color.
  65. /// </summary>
  66. BrighCyan,
  67. /// <summary>
  68. /// The bright red color.
  69. /// </summary>
  70. BrightRed,
  71. /// <summary>
  72. /// The bright magenta color.
  73. /// </summary>
  74. BrightMagenta,
  75. /// <summary>
  76. /// The bright yellow color.
  77. /// </summary>
  78. BrightYellow,
  79. /// <summary>
  80. /// The White color.
  81. /// </summary>
  82. White
  83. }
  84. /// <summary>
  85. /// Attributes are used as elements that contain both a foreground and a background or platform specific features
  86. /// </summary>
  87. /// <remarks>
  88. /// Attributes are needed to map colors to terminal capabilities that might lack colors, on color
  89. /// scenarios, they encode both the foreground and the background color and are used in the ColorScheme
  90. /// class to define color schemes that can be used in your application.
  91. /// </remarks>
  92. public struct Attribute {
  93. internal int value;
  94. internal Color foreground;
  95. internal Color background;
  96. /// <summary>
  97. /// Initializes a new instance of the <see cref="T:Terminal.Gui.Attribute"/> struct.
  98. /// </summary>
  99. /// <param name="value">Value.</param>
  100. /// <param name="foreground">Foreground</param>
  101. /// <param name="background">Background</param>
  102. public Attribute (int value, Color foreground = new Color(), Color background = new Color())
  103. {
  104. this.value = value;
  105. this.foreground = foreground;
  106. this.background = background;
  107. }
  108. /// <summary>
  109. /// Initializes a new instance of the <see cref="T:Terminal.Gui.Attribute"/> struct.
  110. /// </summary>
  111. /// <param name="foreground">Foreground</param>
  112. /// <param name="background">Background</param>
  113. public Attribute (Color foreground = new Color (), Color background = new Color ())
  114. {
  115. this.value = value = ((int)foreground | (int)background << 4);
  116. this.foreground = foreground;
  117. this.background = background;
  118. }
  119. /// <summary>
  120. /// Implicit conversion from an attribute to the underlying Int32 representation
  121. /// </summary>
  122. /// <returns>The integer value stored in the attribute.</returns>
  123. /// <param name="c">The attribute to convert</param>
  124. public static implicit operator int (Attribute c) => c.value;
  125. /// <summary>
  126. /// Implicitly convert an integer value into an attribute
  127. /// </summary>
  128. /// <returns>An attribute with the specified integer value.</returns>
  129. /// <param name="v">value</param>
  130. public static implicit operator Attribute (int v) => new Attribute (v);
  131. /// <summary>
  132. /// Creates an attribute from the specified foreground and background.
  133. /// </summary>
  134. /// <returns>The make.</returns>
  135. /// <param name="foreground">Foreground color to use.</param>
  136. /// <param name="background">Background color to use.</param>
  137. public static Attribute Make (Color foreground, Color background)
  138. {
  139. if (Application.Driver == null)
  140. throw new InvalidOperationException ("The Application has not been initialized");
  141. return Application.Driver.MakeAttribute (foreground, background);
  142. }
  143. }
  144. /// <summary>
  145. /// Color scheme definitions, they cover some common scenarios and are used
  146. /// typically in toplevel containers to set the scheme that is used by all the
  147. /// views contained inside.
  148. /// </summary>
  149. public class ColorScheme {
  150. Attribute _normal;
  151. Attribute _focus;
  152. Attribute _hotNormal;
  153. Attribute _hotFocus;
  154. Attribute _disabled;
  155. internal string caller = "";
  156. /// <summary>
  157. /// The default color for text, when the view is not focused.
  158. /// </summary>
  159. public Attribute Normal { get { return _normal; } set { _normal = SetAttribute (value); } }
  160. /// <summary>
  161. /// The color for text when the view has the focus.
  162. /// </summary>
  163. public Attribute Focus { get { return _focus; } set { _focus = SetAttribute (value); } }
  164. /// <summary>
  165. /// The color for the hotkey when a view is not focused
  166. /// </summary>
  167. public Attribute HotNormal { get { return _hotNormal; } set { _hotNormal = SetAttribute (value); } }
  168. /// <summary>
  169. /// The color for the hotkey when the view is focused.
  170. /// </summary>
  171. public Attribute HotFocus { get { return _hotFocus; } set { _hotFocus = SetAttribute (value); } }
  172. /// <summary>
  173. /// The default color for text, when the view is disabled.
  174. /// </summary>
  175. public Attribute Disabled { get { return _disabled; } set { _disabled = SetAttribute (value); } }
  176. bool preparingScheme = false;
  177. Attribute SetAttribute (Attribute attribute, [CallerMemberName]string callerMemberName = null)
  178. {
  179. if (!Application._initialized && !preparingScheme)
  180. return attribute;
  181. if (preparingScheme)
  182. return attribute;
  183. preparingScheme = true;
  184. switch (caller) {
  185. case "TopLevel":
  186. switch (callerMemberName) {
  187. case "Normal":
  188. HotNormal = Application.Driver.MakeAttribute (HotNormal.foreground, attribute.background);
  189. break;
  190. case "Focus":
  191. HotFocus = Application.Driver.MakeAttribute (HotFocus.foreground, attribute.background);
  192. break;
  193. case "HotNormal":
  194. HotFocus = Application.Driver.MakeAttribute (attribute.foreground, HotFocus.background);
  195. break;
  196. case "HotFocus":
  197. HotNormal = Application.Driver.MakeAttribute (attribute.foreground, HotNormal.background);
  198. if (Focus.foreground != attribute.background)
  199. Focus = Application.Driver.MakeAttribute (Focus.foreground, attribute.background);
  200. break;
  201. }
  202. break;
  203. case "Base":
  204. switch (callerMemberName) {
  205. case "Normal":
  206. HotNormal = Application.Driver.MakeAttribute (HotNormal.foreground, attribute.background);
  207. break;
  208. case "Focus":
  209. HotFocus = Application.Driver.MakeAttribute (HotFocus.foreground, attribute.background);
  210. break;
  211. case "HotNormal":
  212. HotFocus = Application.Driver.MakeAttribute (attribute.foreground, HotFocus.background);
  213. Normal = Application.Driver.MakeAttribute (Normal.foreground, attribute.background);
  214. break;
  215. case "HotFocus":
  216. HotNormal = Application.Driver.MakeAttribute (attribute.foreground, HotNormal.background);
  217. if (Focus.foreground != attribute.background)
  218. Focus = Application.Driver.MakeAttribute (Focus.foreground, attribute.background);
  219. break;
  220. }
  221. break;
  222. case "Menu":
  223. switch (callerMemberName) {
  224. case "Normal":
  225. if (Focus.background != attribute.background)
  226. Focus = Application.Driver.MakeAttribute (attribute.foreground, Focus.background);
  227. HotNormal = Application.Driver.MakeAttribute (HotNormal.foreground, attribute.background);
  228. Disabled = Application.Driver.MakeAttribute (Disabled.foreground, attribute.background);
  229. break;
  230. case "Focus":
  231. Normal = Application.Driver.MakeAttribute (attribute.foreground, Normal.background);
  232. HotFocus = Application.Driver.MakeAttribute (HotFocus.foreground, attribute.background);
  233. break;
  234. case "HotNormal":
  235. if (Focus.background != attribute.background)
  236. HotFocus = Application.Driver.MakeAttribute (attribute.foreground, HotFocus.background);
  237. Normal = Application.Driver.MakeAttribute (Normal.foreground, attribute.background);
  238. Disabled = Application.Driver.MakeAttribute (Disabled.foreground, attribute.background);
  239. break;
  240. case "HotFocus":
  241. HotNormal = Application.Driver.MakeAttribute (attribute.foreground, HotNormal.background);
  242. if (Focus.foreground != attribute.background)
  243. Focus = Application.Driver.MakeAttribute (Focus.foreground, attribute.background);
  244. break;
  245. case "Disabled":
  246. if (Focus.background != attribute.background)
  247. HotFocus = Application.Driver.MakeAttribute (attribute.foreground, HotFocus.background);
  248. Normal = Application.Driver.MakeAttribute (Normal.foreground, attribute.background);
  249. HotNormal = Application.Driver.MakeAttribute (HotNormal.foreground, attribute.background);
  250. break;
  251. }
  252. break;
  253. case "Dialog":
  254. switch (callerMemberName) {
  255. case "Normal":
  256. if (Focus.background != attribute.background)
  257. Focus = Application.Driver.MakeAttribute (attribute.foreground, Focus.background);
  258. HotNormal = Application.Driver.MakeAttribute (HotNormal.foreground, attribute.background);
  259. break;
  260. case "Focus":
  261. Normal = Application.Driver.MakeAttribute (attribute.foreground, Normal.background);
  262. HotFocus = Application.Driver.MakeAttribute (HotFocus.foreground, attribute.background);
  263. break;
  264. case "HotNormal":
  265. if (Focus.background != attribute.background)
  266. HotFocus = Application.Driver.MakeAttribute (attribute.foreground, HotFocus.background);
  267. if (Normal.foreground != attribute.background)
  268. Normal = Application.Driver.MakeAttribute (Normal.foreground, attribute.background);
  269. break;
  270. case "HotFocus":
  271. HotNormal = Application.Driver.MakeAttribute (attribute.foreground, HotNormal.background);
  272. if (Focus.foreground != attribute.background)
  273. Focus = Application.Driver.MakeAttribute (Focus.foreground, attribute.background);
  274. break;
  275. }
  276. break;
  277. case "Error":
  278. switch (callerMemberName) {
  279. case "Normal":
  280. HotNormal = Application.Driver.MakeAttribute (HotNormal.foreground, attribute.background);
  281. HotFocus = Application.Driver.MakeAttribute (HotFocus.foreground, attribute.background);
  282. break;
  283. case "HotNormal":
  284. case "HotFocus":
  285. HotFocus = Application.Driver.MakeAttribute (attribute.foreground, attribute.background);
  286. Normal = Application.Driver.MakeAttribute (Normal.foreground, attribute.background);
  287. break;
  288. }
  289. break;
  290. }
  291. preparingScheme = false;
  292. return attribute;
  293. }
  294. }
  295. /// <summary>
  296. /// The default ColorSchemes for the application.
  297. /// </summary>
  298. public static class Colors {
  299. static ColorScheme _toplevel;
  300. static ColorScheme _base;
  301. static ColorScheme _dialog;
  302. static ColorScheme _menu;
  303. static ColorScheme _error;
  304. /// <summary>
  305. /// The application toplevel color scheme, for the default toplevel views.
  306. /// </summary>
  307. public static ColorScheme TopLevel { get { return _toplevel; } set { _toplevel = SetColorScheme (value); } }
  308. /// <summary>
  309. /// The base color scheme, for the default toplevel views.
  310. /// </summary>
  311. public static ColorScheme Base { get { return _base; } set { _base = SetColorScheme (value); } }
  312. /// <summary>
  313. /// The dialog color scheme, for standard popup dialog boxes
  314. /// </summary>
  315. public static ColorScheme Dialog { get { return _dialog; } set { _dialog = SetColorScheme (value); } }
  316. /// <summary>
  317. /// The menu bar color
  318. /// </summary>
  319. public static ColorScheme Menu { get { return _menu; } set { _menu = SetColorScheme (value); } }
  320. /// <summary>
  321. /// The color scheme for showing errors.
  322. /// </summary>
  323. public static ColorScheme Error { get { return _error; } set { _error = SetColorScheme (value); } }
  324. static ColorScheme SetColorScheme (ColorScheme colorScheme, [CallerMemberName]string callerMemberName = null)
  325. {
  326. colorScheme.caller = callerMemberName;
  327. return colorScheme;
  328. }
  329. }
  330. /// <summary>
  331. /// Special characters that can be drawn with Driver.AddSpecial.
  332. /// </summary>
  333. public enum SpecialChar {
  334. /// <summary>
  335. /// Horizontal line character.
  336. /// </summary>
  337. HLine,
  338. /// <summary>
  339. /// Vertical line character.
  340. /// </summary>
  341. VLine,
  342. /// <summary>
  343. /// Stipple pattern
  344. /// </summary>
  345. Stipple,
  346. /// <summary>
  347. /// Diamond character
  348. /// </summary>
  349. Diamond,
  350. /// <summary>
  351. /// Upper left corner
  352. /// </summary>
  353. ULCorner,
  354. /// <summary>
  355. /// Lower left corner
  356. /// </summary>
  357. LLCorner,
  358. /// <summary>
  359. /// Upper right corner
  360. /// </summary>
  361. URCorner,
  362. /// <summary>
  363. /// Lower right corner
  364. /// </summary>
  365. LRCorner,
  366. /// <summary>
  367. /// Left tee
  368. /// </summary>
  369. LeftTee,
  370. /// <summary>
  371. /// Right tee
  372. /// </summary>
  373. RightTee,
  374. /// <summary>
  375. /// Top tee
  376. /// </summary>
  377. TopTee,
  378. /// <summary>
  379. /// The bottom tee.
  380. /// </summary>
  381. BottomTee,
  382. }
  383. /// <summary>
  384. /// ConsoleDriver is an abstract class that defines the requirements for a console driver. One implementation if the CursesDriver, and another one uses the .NET Console one.
  385. /// </summary>
  386. public abstract class ConsoleDriver {
  387. /// <summary>
  388. /// The handler fired when the terminal is resized.
  389. /// </summary>
  390. protected Action TerminalResized;
  391. /// <summary>
  392. /// The current number of columns in the terminal.
  393. /// </summary>
  394. public abstract int Cols { get; }
  395. /// <summary>
  396. /// The current number of rows in the terminal.
  397. /// </summary>
  398. public abstract int Rows { get; }
  399. /// <summary>
  400. /// Initializes the driver
  401. /// </summary>
  402. /// <param name="terminalResized">Method to invoke when the terminal is resized.</param>
  403. public abstract void Init (Action terminalResized);
  404. /// <summary>
  405. /// Moves the cursor to the specified column and row.
  406. /// </summary>
  407. /// <param name="col">Column to move the cursor to.</param>
  408. /// <param name="row">Row to move the cursor to.</param>
  409. public abstract void Move (int col, int row);
  410. /// <summary>
  411. /// Adds the specified rune to the display at the current cursor position
  412. /// </summary>
  413. /// <param name="rune">Rune to add.</param>
  414. public abstract void AddRune (Rune rune);
  415. /// <summary>
  416. /// Adds the specified
  417. /// </summary>
  418. /// <param name="str">String.</param>
  419. public abstract void AddStr (ustring str);
  420. /// <summary>
  421. /// Prepare the driver and set the key and mouse events handlers.
  422. /// </summary>
  423. /// <param name="mainLoop"></param>
  424. /// <param name="keyHandler"></param>
  425. /// <param name="mouseHandler"></param>
  426. public abstract void PrepareToRun (MainLoop mainLoop, Action<KeyEvent> keyHandler, Action<KeyEvent> keyDownHandler, Action<KeyEvent> keyUpHandler, Action<MouseEvent> mouseHandler);
  427. /// <summary>
  428. /// Updates the screen to reflect all the changes that have been done to the display buffer
  429. /// </summary>
  430. public abstract void Refresh ();
  431. /// <summary>
  432. /// Updates the location of the cursor position
  433. /// </summary>
  434. public abstract void UpdateCursor ();
  435. /// <summary>
  436. /// Ends the execution of the console driver.
  437. /// </summary>
  438. public abstract void End ();
  439. /// <summary>
  440. /// Redraws the physical screen with the contents that have been queued up via any of the printing commands.
  441. /// </summary>
  442. public abstract void UpdateScreen ();
  443. /// <summary>
  444. /// Selects the specified attribute as the attribute to use for future calls to AddRune, AddString.
  445. /// </summary>
  446. /// <param name="c">C.</param>
  447. public abstract void SetAttribute (Attribute c);
  448. /// <summary>
  449. /// Set Colors from limit sets of colors.
  450. /// </summary>
  451. /// <param name="foreground">Foreground.</param>
  452. /// <param name="background">Background.</param>
  453. public abstract void SetColors (ConsoleColor foreground, ConsoleColor background);
  454. // Advanced uses - set colors to any pre-set pairs, you would need to init_color
  455. // that independently with the R, G, B values.
  456. /// <summary>
  457. /// Advanced uses - set colors to any pre-set pairs, you would need to init_color
  458. /// that independently with the R, G, B values.
  459. /// </summary>
  460. /// <param name="foregroundColorId">Foreground color identifier.</param>
  461. /// <param name="backgroundColorId">Background color identifier.</param>
  462. public abstract void SetColors (short foregroundColorId, short backgroundColorId);
  463. /// <summary>
  464. /// Set the handler when the terminal is resized.
  465. /// </summary>
  466. /// <param name="terminalResized"></param>
  467. public void SetTerminalResized(Action terminalResized)
  468. {
  469. TerminalResized = terminalResized;
  470. }
  471. /// <summary>
  472. /// Draws a frame on the specified region with the specified padding around the frame.
  473. /// </summary>
  474. /// <param name="region">Region where the frame will be drawn..</param>
  475. /// <param name="padding">Padding to add on the sides.</param>
  476. /// <param name="fill">If set to <c>true</c> it will clear the contents with the current color, otherwise the contents will be left untouched.</param>
  477. public virtual void DrawFrame (Rect region, int padding, bool fill)
  478. {
  479. int width = region.Width;
  480. int height = region.Height;
  481. int b;
  482. int fwidth = width - padding * 2;
  483. int fheight = height - 1 - padding;
  484. Move (region.X, region.Y);
  485. if (padding > 0) {
  486. for (int l = 0; l < padding; l++)
  487. for (b = 0; b < width; b++)
  488. AddRune (' ');
  489. }
  490. Move (region.X, region.Y + padding);
  491. for (int c = 0; c < padding; c++)
  492. AddRune (' ');
  493. AddRune (ULCorner);
  494. for (b = 0; b < fwidth - 2; b++)
  495. AddRune (HLine);
  496. AddRune (URCorner);
  497. for (int c = 0; c < padding; c++)
  498. AddRune (' ');
  499. for (b = 1 + padding; b < fheight; b++) {
  500. Move (region.X, region.Y + b);
  501. for (int c = 0; c < padding; c++)
  502. AddRune (' ');
  503. AddRune (VLine);
  504. if (fill) {
  505. for (int x = 1; x < fwidth - 1; x++)
  506. AddRune (' ');
  507. } else
  508. Move (region.X + fwidth - 1, region.Y + b);
  509. AddRune (VLine);
  510. for (int c = 0; c < padding; c++)
  511. AddRune (' ');
  512. }
  513. Move (region.X, region.Y + fheight);
  514. for (int c = 0; c < padding; c++)
  515. AddRune (' ');
  516. AddRune (LLCorner);
  517. for (b = 0; b < fwidth - 2; b++)
  518. AddRune (HLine);
  519. AddRune (LRCorner);
  520. for (int c = 0; c < padding; c++)
  521. AddRune (' ');
  522. if (padding > 0) {
  523. Move (region.X, region.Y + height - padding);
  524. for (int l = 0; l < padding; l++)
  525. for (b = 0; b < width; b++)
  526. AddRune (' ');
  527. }
  528. }
  529. /// <summary>
  530. /// Suspend the application, typically needs to save the state, suspend the app and upon return, reset the console driver.
  531. /// </summary>
  532. public abstract void Suspend ();
  533. Rect clip;
  534. /// <summary>
  535. /// Controls the current clipping region that AddRune/AddStr is subject to.
  536. /// </summary>
  537. /// <value>The clip.</value>
  538. public Rect Clip {
  539. get => clip;
  540. set => this.clip = value;
  541. }
  542. /// <summary>
  543. /// Start of mouse moves.
  544. /// </summary>
  545. public abstract void StartReportingMouseMoves ();
  546. /// <summary>
  547. /// Stop reporting mouses moves.
  548. /// </summary>
  549. public abstract void StopReportingMouseMoves ();
  550. /// <summary>
  551. /// Disables the cooked event processing from the mouse driver. At startup, it is assumed mouse events are cooked.
  552. /// </summary>
  553. public abstract void UncookMouse ();
  554. /// <summary>
  555. /// Enables the cooked event processing from the mouse driver
  556. /// </summary>
  557. public abstract void CookMouse ();
  558. /// <summary>
  559. /// Horizontal line character.
  560. /// </summary>
  561. public Rune HLine;
  562. /// <summary>
  563. /// Vertical line character.
  564. /// </summary>
  565. public Rune VLine;
  566. /// <summary>
  567. /// Stipple pattern
  568. /// </summary>
  569. public Rune Stipple;
  570. /// <summary>
  571. /// Diamond character
  572. /// </summary>
  573. public Rune Diamond;
  574. /// <summary>
  575. /// Upper left corner
  576. /// </summary>
  577. public Rune ULCorner;
  578. /// <summary>
  579. /// Lower left corner
  580. /// </summary>
  581. public Rune LLCorner;
  582. /// <summary>
  583. /// Upper right corner
  584. /// </summary>
  585. public Rune URCorner;
  586. /// <summary>
  587. /// Lower right corner
  588. /// </summary>
  589. public Rune LRCorner;
  590. /// <summary>
  591. /// Left tee
  592. /// </summary>
  593. public Rune LeftTee;
  594. /// <summary>
  595. /// Right tee
  596. /// </summary>
  597. public Rune RightTee;
  598. /// <summary>
  599. /// Top tee
  600. /// </summary>
  601. public Rune TopTee;
  602. /// <summary>
  603. /// The bottom tee.
  604. /// </summary>
  605. public Rune BottomTee;
  606. /// <summary>
  607. /// Make the attribute for the foreground and background colors.
  608. /// </summary>
  609. /// <param name="fore">Foreground.</param>
  610. /// <param name="back">Background.</param>
  611. /// <returns></returns>
  612. public abstract Attribute MakeAttribute (Color fore, Color back);
  613. }
  614. }