aboutsummaryrefslogtreecommitdiff
path: root/include/video_console.h
diff options
context:
space:
mode:
authorSimon Glass2023-06-01 10:22:45 -0600
committerTom Rini2023-07-14 12:54:51 -0400
commit648a4991d0713af656a2fa50ec8e708c2beb044e (patch)
tree123ef23118df5fb6961dc211982af5b3886b03ba /include/video_console.h
parent7ea207db2afc1ef70d8dc88fd2914b3ffcfbb1c7 (diff)
video: Allow temporary colour changes
It is sometimes necessary to highlight some text in a different colour. Add an easy way to do this and then restore the original console colours. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/video_console.h')
-rw-r--r--include/video_console.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/video_console.h b/include/video_console.h
index 3db9a7e1fb9..81d4c4d874d 100644
--- a/include/video_console.h
+++ b/include/video_console.h
@@ -72,6 +72,17 @@ struct vidfont_info {
};
/**
+ * struct vidconsole_colour - Holds colour information
+ *
+ * @colour_fg: Foreground colour (pixel value)
+ * @colour_bg: Background colour (pixel value)
+ */
+struct vidconsole_colour {
+ u32 colour_fg;
+ u32 colour_bg;
+};
+
+/**
* struct vidconsole_ops - Video console operations
*
* These operations work on either an absolute console position (measured
@@ -205,6 +216,25 @@ int vidconsole_get_font(struct udevice *dev, int seq,
int vidconsole_select_font(struct udevice *dev, const char *name, uint size);
/**
+ * vidconsole_push_colour() - Temporarily change the font colour
+ *
+ * @dev: Device to adjust
+ * @fg: Foreground colour to select
+ * @bg: Background colour to select
+ * @old: Place to store the current colour, so it can be restored
+ */
+void vidconsole_push_colour(struct udevice *dev, enum colour_idx fg,
+ enum colour_idx bg, struct vidconsole_colour *old);
+
+/**
+ * vidconsole_pop_colour() - Restore the original colour
+ *
+ * @dev: Device to adjust
+ * @old: Old colour to be restored
+ */
+void vidconsole_pop_colour(struct udevice *dev, struct vidconsole_colour *old);
+
+/**
* vidconsole_putc_xy() - write a single character to a position
*
* @dev: Device to write to