--- /dev/null
+pub struct ColouredString {
+ text: String,
+ colour: String,
+}
+
+impl ColouredString {
+ pub fn plain(text: &str) -> Self {
+ ColouredString { text: text.to_string(),
+ colour: " ".repeat(text.len()) }
+ }
+ pub fn uniform(text: &str, colour: char) -> Self {
+ ColouredString { text: text.to_string(),
+ colour: colour.to_string().repeat(text.len()) }
+ }
+ pub fn general(text: &str, colour: &str) -> Self {
+ assert!(text.len() == colour.len(),
+ "Mismatched lengths in ColouredString::general");
+ ColouredString { text: text.to_string(),
+ colour: colour.to_string() }
+ }
+}