diff --git a/CHANGELOG.md b/CHANGELOG.md
index c333391..08657ce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+- Update browser preview
+
## 0.2.2
- Thanks to tui's upgrade, mono render don't need do a huge bitmap copy to render char, this will improve some pref
diff --git a/src/preview/browser/builder.rs b/src/preview/browser/builder.rs
index 1ce15b0..4cc464d 100644
--- a/src/preview/browser/builder.rs
+++ b/src/preview/browser/builder.rs
@@ -52,6 +52,7 @@ impl<'a> Builder<'a> {
format!(
include_str!("statics/template.html"),
style = include_str!("statics/style.css"),
+ script = include_str!("statics/script.js"),
font_previews = self
.families
.into_iter()
diff --git a/src/preview/browser/statics/preview_block_template.html b/src/preview/browser/statics/preview_block_template.html
index 583db0f..92b48af 100644
--- a/src/preview/browser/statics/preview_block_template.html
+++ b/src/preview/browser/statics/preview_block_template.html
@@ -1,4 +1,8 @@
-
-
{char}
-
{family}
+
\ No newline at end of file
diff --git a/src/preview/browser/statics/script.js b/src/preview/browser/statics/script.js
new file mode 100644
index 0000000..ba2f53b
--- /dev/null
+++ b/src/preview/browser/statics/script.js
@@ -0,0 +1,23 @@
+const colToHex = (c) => {
+ let color = (c < 75) ? c + 75 : c
+ let hex = color.toString(16);
+ return hex.length == 1 ? "0" + hex : hex;
+}
+
+const rgbToHex = (r,g,b) => {
+ return "#" + colToHex(r) + colToHex(g) + colToHex(b);
+}
+
+const getRandomColor = () => {
+ return rgbToHex(
+ Math.floor(Math.random() * 255),
+ Math.floor(Math.random() * 255),
+ Math.floor(Math.random() * 255));
+}
+
+document.addEventListener("DOMContentLoaded", function () {
+ const cards = document.getElementsByClassName("card");
+ for (i = 0; i < cards.length; i++) {
+ cards[i].style.backgroundColor = getRandomColor();
+ }
+});
diff --git a/src/preview/browser/statics/style.css b/src/preview/browser/statics/style.css
index 942385b..478ca69 100644
--- a/src/preview/browser/statics/style.css
+++ b/src/preview/browser/statics/style.css
@@ -1,72 +1,56 @@
-a, abbr, acronym, address, applet, article, aside, audio, b, big, blockquote, body, canvas, caption, center, cite, code,
-dd, del, details, dfn, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6,
-header, hgroup, html, i, iframe, img, ins, kbd, label, legend, li, mark, menu, nav, object, ol, output, p, pre, q, ruby,
-s, samp, section, small, span, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, time, tr, tt, u,
-ul, var, video {
- margin: 0;
- padding: 0;
- border: 0;
- font-size: 100%;
- font: inherit;
- vertical-align: baseline;
-}
-article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
- display: block;
-}
-body {
- font-size: 1.5em;
- line-height: 2rem;
- font-weight: 400;
- font-family: "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif;
- color: #222;
- height: 100%;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
-ol, ul {
- list-style: none;
-}
-blockquote, q {
- quotes: none;
-}
-blockquote:after, blockquote:before, q:after, q:before {
- content: '';
- content: none;
-}
-table {
- border-collapse: collapse;
- border-spacing: 0;
-}
.container {
+ justify-content: center;
+ padding: 0.01em;
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ }
+
+ body {
+ font-size: 80px;
+ background: #222;
+ }
+
+ p {
+ color: #222;
+ }
+
+ .pb {
+ height: 320px;
+ width: 240px;
position: relative;
- font-size: 32px;
- min-height: 100vh;
- width: 100%;
- height: 100%;
- padding: 1rem;
display: flex;
- background-color: #e1e1e1;
- flex-flow: row wrap;
+ justify-content: center;
+ align-items: center;
+ }
+
+ .preview {
+ position: absolute;
+ font-size: 2em;
text-align: center;
- box-sizing: border-box;
-}
-.container .item {
+ margin: 0;
+ }
+
+ .fb {
+ margin-top: -0.2em;
+ margin-bottom: 0.5em;
+ padding-left: 0.1em;
+ height: 10px;
+ width: 220px;
position: relative;
- display: inline-block;
- flex: 1 1 auto;
- padding: 1rem;
- margin: 1rem;
- text-align: center;
- background-color: #fafafa;
- border: 3px solid transparent;
-}
-.container .item .preview {
- padding: 1.5rem 6.5rem;
- line-height: 1.4em;
- font-size: 2.827em;
-}
-.container .item .fontName {
- font-size: .85rem;
- color: #bfbfbf;
- letter-spacing: 0.5px;
-}
\ No newline at end of file
+ }
+
+ .card {
+ margin: 0.05em;
+ padding: 0.1em;
+ border-radius: 0.1em;
+ }
+
+ .font-name {
+ border-top: 2px solid #222;
+ font-family: sans-serif;
+ font-size: 2px;
+ padding-left: 0.5em;
+ padding-top: 0.8em;
+ }
+
\ No newline at end of file
diff --git a/src/preview/browser/statics/template.html b/src/preview/browser/statics/template.html
index 035ff87..e069597 100644
--- a/src/preview/browser/statics/template.html
+++ b/src/preview/browser/statics/template.html
@@ -13,5 +13,8 @@
{font_previews}
+