Skip to content

Commit 3c82e88

Browse files
add theming instructions on README.md file
1 parent 65917b4 commit 3c82e88

File tree

1 file changed

+68
-5
lines changed

1 file changed

+68
-5
lines changed

Diff for: README.md

+68-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,23 @@
22

33
Simple JSON viewer component, for Vue.js 2
44

5-
## Installing:
5+
- [Installing](#Installing)
6+
- [Example](#Example)
7+
- [Options](#Options)
8+
- [Theming](#Theming)
9+
10+
## Installing
611
Using npm:
712
```
8-
$ npm install vue-json-viewer
13+
$ npm install vue-json-viewer --save
914
```
1015

1116
Using yarn:
1217
```
1318
$ yarn add vue-json-viewer
1419
```
1520

16-
## Example:
21+
## Example
1722

1823
``` html
1924
<json-viewer :value="jsonData"></json-viewer>
@@ -103,11 +108,11 @@ new Vue({
103108
}
104109
})
105110
```
106-
## Result:
111+
### Preview
107112
![preview](./example/preview.png)
108113

109114

110-
## Options:
115+
## Options
111116

112117
| Property | Description | Default |
113118
| ----------- |:------------- | ----------- |
@@ -117,3 +122,61 @@ new Vue({
117122
| `sort` | Sort keys before displaying | `false` |
118123
| `boxed` | Add a fancy "boxed" style to component | `false` |
119124
| `theme` | Add a custom CSS class for theming purposes | `jv-light` |
125+
126+
## Theming
127+
128+
To create custom theme, (e.g. `my-awesome-json-theme`), in two easy steps:
129+
1. add `theme="my-awesome-json-theme"` to the JsonViewer component
130+
2. copy-pasta and customize this SCSS template:
131+
132+
``` scss
133+
// values are default one from jv-light template
134+
.my-awesome-json-theme {
135+
background: #fff;
136+
white-space: nowrap;
137+
color: #525252;
138+
font-size: 14px;
139+
font-family: Consolas, Menlo, Courier, monospace;
140+
141+
.jv-ellipsis {
142+
color: #999;
143+
background-color: #eee;
144+
display: inline-block;
145+
line-height: 0.9;
146+
font-size: 0.9em;
147+
padding: 0px 4px 2px 4px;
148+
border-radius: 3px;
149+
vertical-align: 2px;
150+
cursor: pointer;
151+
user-select: none;
152+
}
153+
.jv-button { color: #49b3ff }
154+
.jv-key { color: #111111 }
155+
.jv-item {
156+
&.jv-array { color: #111111 }
157+
&.jv-boolean { color: #fc1e70 }
158+
&.jv-function { color: #067bca }
159+
&.jv-number { color: #fc1e70 }
160+
&.jv-object { color: #111111 }
161+
&.jv-undefined { color: #e08331 }
162+
&.jv-string {
163+
color: #42b983;
164+
word-break: break-word;
165+
white-space: normal;
166+
}
167+
}
168+
.jv-code {
169+
.jv-toggle {
170+
&:before {
171+
padding: 0px 2px;
172+
border-radius: 2px;
173+
}
174+
&:hover {
175+
&:before {
176+
background: #eee;
177+
}
178+
}
179+
}
180+
}
181+
}
182+
```

0 commit comments

Comments
 (0)