Skip to content

Commit

Permalink
chore(screenshot): adjust pretty under json
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jan 3, 2022
1 parent 898ac18 commit a164dec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions packages/cli/src/commands/screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ module.exports = async ({ url, browserless, opts }) => {
}

if (opts.codeScheme === 'ghcolors') {
const isDark = await darkMode.isDark()
const isDark = darkMode.isDark()
opts.colorScheme = isDark ? 'dark' : 'light'

opts.styles = isDark
? '#screenshot pre{background:#000}#screenshot .token.string{color:#50e3c2}#screenshot .token.number{color:#f81ce5}'
: '#screenshot pre{background:#fff}#screenshot .token.string{color:#f81ce5}#screenshot .token.number{color:#50e3c2}'
opts.styles = [
isDark
? '#screenshot pre{background:#000}#screenshot .token.string{color:#50e3c2}#screenshot .token.number{color:#f81ce5}'
: '#screenshot pre{background:#fff}#screenshot .token.string{color:#f81ce5}#screenshot .token.number{color:#50e3c2}',
'#screenshot .language-js span{font-family:"Roboto Mono"}'
]
}

const screenshot = await browserless.screenshot(url, opts)
Expand Down
2 changes: 1 addition & 1 deletion packages/screenshot/src/pretty/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const resetCSS = `<style>
}
</style>`

const JSON_MAX_LENGTH = 76 * 0.5
const JSON_MAX_LENGTH = 72 * 0.5
const TEXT_MAX_LENGTH = 96 * 0.6

const truncate = (input, maxLength) => {
Expand Down

0 comments on commit a164dec

Please sign in to comment.