Skip to content

Commit fff6d43

Browse files
authored
Constants: add numeric css class (#745)
1 parent 8b3366d commit fff6d43

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

data/granite.metainfo.xml.in

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@
2727
<update_contact>contact_at_elementary.io</update_contact>
2828

2929
<releases>
30+
<release version="7.7.0" date="2025-02-10" urgency="medium">
31+
<description>
32+
<p>New Features:</p>
33+
<ul>
34+
<li>Granite.CssClass.NUMERIC</li>
35+
</ul>
36+
<p>Improvements:</p>
37+
<ul>
38+
<li>Updated translations</li>
39+
</ul>
40+
</description>
41+
</release>
42+
3043
<release version="7.6.0" date="2024-11-21" urgency="medium">
3144
<description>
3245
<p>New Features:</p>

demo/Views/CSSView.vala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ public class CSSView : Gtk.Box {
2929
};
3030
header4.add_css_class (Granite.STYLE_CLASS_H4_LABEL);
3131

32+
var numeric = new Gtk.Label ("\"numeric\" Style Class 123.4") {
33+
margin_bottom = 12
34+
};
35+
numeric.add_css_class (Granite.CssClass.NUMERIC);
36+
3237
var card_header = new Granite.HeaderLabel ("Cards and Headers") {
3338
secondary_text = "\"card\" with \"rounded\" and \"checkerboard\" style classes"
3439
};
@@ -41,6 +46,7 @@ public class CSSView : Gtk.Box {
4146
card.append (header2);
4247
card.append (header3);
4348
card.append (header4);
49+
card.append (numeric);
4450

4551
var richlist_label = new Granite.HeaderLabel ("Lists") {
4652
secondary_text = "\"rich-list\" and \"frame\" style classes"

lib/Constants.vala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,18 @@ namespace Granite {
190190
*/
191191
public const int TRANSITION_DURATION_OPEN = 250;
192192

193+
/**
194+
* CSS style classes to be used with {@link Gtk.Widget.add_css_class}
195+
*/
196+
[Version (since = "7.7.0")]
197+
namespace CssClass {
198+
199+
/**
200+
* sets font features to use tabular numbers. Equivalent of Pango's tnum property
201+
*/
202+
public const string NUMERIC = "numeric";
203+
}
204+
193205
/**
194206
* Deep links to specific Settings pages.
195207
*/

lib/Styles/_label.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
opacity: 0.75;
2626
}
2727

28+
.numeric {
29+
font-feature-settings: "tnum";
30+
}
31+
2832
// Intended to match the Pango size of `<small>` and `size='smaller'`
2933
.small-label {
3034
font-size: 0.85em;

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ project(
22
'granite-7',
33
'vala', 'c',
44
meson_version: '>= 0.57.0',
5-
version: '7.6.0'
5+
version: '7.7.0'
66
)
77

88
if meson.get_compiler('vala').version().version_compare('<0.48.0')

0 commit comments

Comments
 (0)