Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions demo/Views/CSSView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public class CSSView : DemoPage {
card_box.append (card);
card_box.append (card_checkered);

var terminal_label = new Granite.HeaderLabel ("\"terminal\" style class");
var terminal_label = new Granite.HeaderLabel
("\"Granite.CssClass.TERMINAL\"");

var terminal = new Gtk.Label ("[ 73%] Linking C executable granite-demo\n[100%] Built target granite-demo") {
selectable = true,
Expand All @@ -97,7 +98,7 @@ public class CSSView : DemoPage {
min_content_height = 70,
child = terminal
};
terminal_scroll.add_css_class (Granite.STYLE_CLASS_TERMINAL);
terminal_scroll.add_css_class (Granite.CssClass.TERMINAL);

var accent_color_label = new Granite.HeaderLabel ("Colored labels and icons");

Expand Down
10 changes: 10 additions & 0 deletions lib/Constants.vala
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ namespace Granite {
* When used with {@link Gtk.Label} this style includes internal padding. When used with {@link Gtk.TextView}
* interal padding will need to be set with {@link Gtk.Container.border_width}
*/
[Version (deprecated = true, deprecated_since = "7.7.0", replacement = "Granite.CssClass.TERMINAL")]
public const string STYLE_CLASS_TERMINAL = "terminal";
/**
* Style class for title label text in a {@link Granite.MessageDialog}
Expand Down Expand Up @@ -290,6 +291,15 @@ namespace Granite {
* Style class for non-terminal text that uses a monospace font.
*/
public const string MONOSPACE = "monospace";

/**
* Style class for {@link Gtk.Label} or {@link Gtk.TextView} to emulate the appearance of Terminal. This includes
* text color, background color, selection highlighting, and selecting the system monospace font.
*
* When used with {@link Gtk.Label} this style includes internal padding. When used with {@link Gtk.TextView}
* interal padding will need to be set with {@link Gtk.Container.border_width}
*/
public const string TERMINAL = "terminal";
}

/**
Expand Down
18 changes: 18 additions & 0 deletions lib/Styles/Granite/_classes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,21 @@ paper {
font-family: monospace;
}

.terminal {
font-family: monospace;

background-color: $fg-color;
color: bg-color(0);

padding: rem(12px) rem(18px);

& selection {
background-color: bg-color(0);
color: $fg-color;

&:backdrop {
// Cancelling values set in non-terminal selection
background-color: inherit;
}
}
}