Skip to content

Commit 4f8b8ea

Browse files
committed
Fix css for gui
1 parent f329556 commit 4f8b8ea

File tree

2 files changed

+109
-18
lines changed

2 files changed

+109
-18
lines changed

src/controls.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,17 @@ export class URDFControls extends GUI {
2828
this.width = 310;
2929
this.domElement.style.position = 'absolute';
3030
this.domElement.style.top = '0';
31-
this.domElement.style.right = '0';
31+
this.domElement.style.right = '5px';
32+
this.domElement.setAttribute('class', 'dg main urdf-gui');
3233

3334
this._workspaceFolder = this.addFolder('Workspace');
35+
this._workspaceFolder.domElement.setAttribute('class', 'dg workspace-folder');
36+
3437
this._sceneFolder = this.addFolder('Scene');
38+
this._sceneFolder.domElement.setAttribute('class', 'dg scene-folder');
39+
3540
this._jointsFolder = this.addFolder('Joints');
41+
this._jointsFolder.domElement.setAttribute('class', 'dg joints-folder');
3642
}
3743

3844
get workspaceFolder() {

style/base.css

Lines changed: 102 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,123 @@
44
https://jupyterlab.readthedocs.io/en/stable/developer/css.html
55
*/
66

7+
:root {
8+
--gui-color-background: var(--jp-layout-color2);
9+
--gui-color-title-bg: var(--jp-layout-color3);
10+
--gui-color-input-bg: color-mix(in hsl, var(--jp-layout-color1), var(--jp-layout-color2));
11+
--gui-color-font: var(--jp-ui-font-color1);
12+
--gui-color-accent: var(--jp-brand-color0);
13+
--gui-transparent: rgba(0, 0, 0, 0);
14+
}
15+
716
.jp-urdf-canvas .lm-Widget canvas {
817
width: 100%;
918
height: 100%;
1019
}
1120

1221
/* Dat.GUI */
13-
.jp-urdf-canvas .lm-Widget .dg .folder {
14-
background: #1A1A1A;
22+
.urdf-gui {
23+
background: var(--gui-color-background);
24+
color: var(--gui-color-font);
25+
border: none;
26+
box-sizing: border-box;
1527
}
1628

17-
#jointFolder ul{
18-
max-height: 50vh;
19-
overflow: scroll;
29+
.urdf-gui li.folder {
30+
/* border: 0.4em solid var(--gui-transparent) !important; */
31+
border-left: 0.4em solid black !important;
32+
border-right: 0.4em solid black;
2033
}
2134

22-
#settingsFolder ul {
23-
text-align: center;
35+
.urdf-gui li.title {
36+
margin: 0 0 0.5em 0 !important;
37+
}
38+
39+
.urdf-gui .cr.function:hover {
40+
background: var(--gui-transparent) !important;
2441
}
2542

26-
#settingsFolder li.cr.function {
27-
border: 1px solid #303030;
28-
background: #252525;
43+
.urdf-gui .cr.function .property-name {
44+
background: var(--gui-color-input-bg);
45+
border: 1px solid var(--gui-color-title-bg);
2946
border-radius: 3px;
30-
width: 280px;
31-
display: inline-block;
32-
margin: 2px 0;
47+
text-align: center;
48+
max-height: 2em;
49+
display: flex;
50+
align-items: center;
51+
justify-content: center;
3352
}
3453

35-
#settingsFolder li.cr.function:hover {
36-
background: #494949;
54+
.urdf-gui .cr.function .property-name:hover {
55+
background: var(--gui-color-accent);
56+
border: 1px solid var(--gui-color-accent);
3757
}
3858

39-
#settingsFolder .function .property-name {
59+
.urdf-gui .cr.color,
60+
.urdf-gui .cr.number,
61+
.urdf-gui .cr.function,
62+
.urdf-gui .cr.string {
63+
background: var(--gui-color-background);
64+
color: var(--gui-color-font);
65+
border: none !important;
66+
text-shadow: none;
67+
padding: 0.2em 0.4em 0.2em 0.4em;
68+
}
69+
70+
.urdf-gui .cr.string input[type="text"],
71+
.urdf-gui .cr.number input[type="text"],
72+
.urdf-gui .cr.color input[type="text"] {
73+
margin: 0 !important;
74+
padding: 0 !important;
75+
border: 1px solid var(--gui-color-title-bg) !important;
76+
border-radius: 3px;
77+
background: var(--gui-color-input-bg);
4078
text-align: center;
41-
}
79+
text-shadow: none;
80+
}
81+
82+
.urdf-gui .cr.string input[type="text"],
83+
.urdf-gui .cr.number input[type="text"] {
84+
color: var(--gui-color-font) !important;
85+
}
86+
87+
.urdf-gui .cr.string input[type="text"]:hover,
88+
.urdf-gui .cr.number input[type="text"]:hover,
89+
.urdf-gui .cr.string input[type="text"]:focus,
90+
.urdf-gui .cr.number input[type="text"]:focus {
91+
background: var(--gui-color-title-bg);
92+
}
93+
94+
.urdf-gui .closed li:not(.title) {
95+
padding: 0;
96+
}
97+
98+
.urdf-gui .c .slider {
99+
margin: 0.5em 0 0 0;
100+
height: 1em;
101+
background: var(--gui-color-background) !important;
102+
border: 1px solid var(--gui-color-title-bg);
103+
border-radius: 3px;
104+
box-sizing: border-box;
105+
}
106+
107+
.urdf-gui .c .slider:hover {
108+
background: var(--gui-color-background) !important;
109+
}
110+
111+
.urdf-gui .c .slider-fg {
112+
background: var(--gui-color-font) !important;
113+
border: 1px solid var(--gui-color-font);
114+
border-radius: 3px;
115+
margin: -1px;
116+
opacity: 50%;
117+
}
118+
119+
.urdf-gui .joints-folder {
120+
border-top: 0.4em solid black;
121+
}
122+
123+
.urdf-gui .joints-folder ul{
124+
max-height: 50vh;
125+
overflow: scroll;
126+
}

0 commit comments

Comments
 (0)