PRA*_*TAP 9 javascript css ubuntu
Ubuntu 18.04
我正在自定义面板,这是.css文件中的内容
我已经添加了::first-line部分到cusomize第一行,如下图所示.但重启后不会应用它.
.css文件的内容:
#panel .clock-display {
color: blue; }
#panel .clock-display::first-line {
color: green; }
Run Code Online (Sandbox Code Playgroud)
.js文件的内容:
var DateMenuButton = new Lang.Class({
Name: 'DateMenuButton',
Extends: PanelMenu.Button,
_init() {
let item;
let hbox;
let vbox;
let menuAlignment = 0.5;
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
menuAlignment = 1.0 - menuAlignment;
this.parent(menuAlignment);
this._clockDisplay = new St.Label({ y_align: Clutter.ActorAlign.CENTER });
this._indicator = new MessagesIndicator();
let box = new St.BoxLayout();
box.add_actor(new IndicatorPad(this._indicator.actor));
box.add_actor(this._clockDisplay);
box.add_actor(this._indicator.actor);
this.actor.label_actor = this._clockDisplay;
this.actor.add_actor(box);
this.actor.add_style_class_name ('clock-display');
Run Code Online (Sandbox Code Playgroud)
在最后一行,this.actor.add_style_calss_name ('clock-display');我想我必须指定它pseudo_calss或什么,但我不知道.
如果您看到带有时间戳的日期,则在下图中,这是新安装Ubuntu时的默认行为.

通过使用时钟覆盖扩展,可以制作我们自己的文本..就像在这个图像..
这是一个线索,这个时钟覆盖扩展具有特殊功能,通过添加%n其设置来生成下一行https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format
时钟覆盖扩展详细信息:https://extensions.gnome.org/extension/1206/clock-override/
问题:我希望在.css文件中独立配置两条线,以选择颜色,高度,重量,阴影,边框等.
它可以实现吗?
这里所有相关文件:https: //wetransfer.com/downloads/dd97a53972b17f746225efdfa345a03220181231063516/111ced
您可以尝试向特定对象添加样式类吗?
\n\n例如:#475行
\n\nthis._clockDisplay = new St.Label({ y_align: Clutter.ActorAlign.CENTER, style_class: 'clock-label' });\nRun Code Online (Sandbox Code Playgroud)\n\nCSS:
\n\n.clock-label { color:\xc2\xa0#101010; font-weight: bold;\xc2\xa0background: #fff; }\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
313 次 |
| 最近记录: |