-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
2,220 additions
and
5,735 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<head> | ||
<link rel="stylesheet" href="style.css" /> | ||
</head> | ||
<body> | ||
<div class="theme-review"> | ||
<div class="theme-container dark"> | ||
<h2>Dark theme</h2> | ||
<ul> | ||
{{icons}} | ||
</ul> | ||
</div> | ||
<div class="theme-container light"> | ||
<h2>Light Theme</h2> | ||
<ul> | ||
{{icons}} | ||
</ul> | ||
</div> | ||
</div> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
:root { | ||
--main-bg-color: #1e1e1e; | ||
--dark-theme-bg-color: #1e1e1e; | ||
--dark-theme-font-color: #fafafa; | ||
--light-theme-bg-color: #f3f3f3; | ||
--light-theme-font-color: #424242; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
padding: 0; | ||
font-family: arial, sans-serif; | ||
border-collapse: collapse; | ||
width: 100%; | ||
background: var(--main-bg-color); | ||
font-size: 1rem; | ||
} | ||
|
||
.theme-review { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr; | ||
grid-template-rows: 1fr; | ||
} | ||
|
||
.theme-review ul { | ||
list-style: none; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
.theme-container { | ||
padding: 20px; | ||
} | ||
|
||
.theme-container > h2 { | ||
font-size: 1.25rem; | ||
margin-top: 0; | ||
} | ||
|
||
.theme-container.dark { | ||
color: var(--dark-theme-font-color); | ||
background: var(--dark-theme-bg-color); | ||
} | ||
|
||
.theme-container.light { | ||
color: var(--light-theme-font-color); | ||
background: var(--light-theme-bg-color); | ||
} | ||
|
||
.icon { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.icon > img { | ||
width: 16px; | ||
height: 22px; | ||
padding-right: 6px; | ||
} | ||
|
||
.icon > span { | ||
font-size: 13px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { readFileSync, writeFileSync } from 'fs'; | ||
import { join } from 'path'; | ||
import { green, red } from '../cli/utils'; | ||
import { createScreenshot } from './utils/screenshot'; | ||
|
||
/** | ||
* Generates | ||
* | ||
* @param fileNames List of SVG file names | ||
*/ | ||
export const generatePreview = async (fileNames: string[]) => { | ||
const previewFilePath = join('/demo/preview.html'); | ||
const previewFile = readFileSync(previewFilePath, 'utf8'); | ||
|
||
const placeholder = '{{icons}}'; | ||
const iconTemplate = fileNames.reduce((acc, fileName) => { | ||
const iconName = fileName.split('.')[0]; | ||
return `${acc}<li><div class="icon"><img src="./icons/${fileName}" alt="${iconName}" /><span class="iconName">${iconName}</span></div></li>`; | ||
}, ''); | ||
const finalTemplate = previewFile.replaceAll(placeholder, iconTemplate); | ||
writeFileSync(previewFilePath + '_final.html', finalTemplate); | ||
|
||
try { | ||
await createScreenshot(previewFilePath + '_final.html', 'preview'); | ||
console.log( | ||
'> Material Icon Theme:', | ||
green(`Successfully created preview image!`) | ||
); | ||
} catch (error) { | ||
throw Error(red(`Error while creating preview image`)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export * from './validate'; | ||
export * from './suggestions'; | ||
export * from './generate-preview'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export * from './isValidColor'; | ||
export * from './toHex'; | ||
export * from './screenshot'; |
Oops, something went wrong.