11import React from 'react'
22import { Box , Text , Button , themeGet } from '@primer/react'
33import { Octicon } from '@primer/react/deprecated'
4- import { Highlight , themes , Prism } from 'prism-react-renderer'
4+ import { Highlight , Prism } from 'prism-react-renderer'
55import styled from 'styled-components'
66import { CheckIcon , CopyIcon } from '@primer/octicons-react'
77import copyToClipboard from 'copy-to-clipboard'
88import { announce } from '../util/aria-live'
9+ import { usePrismTheme } from '../hooks/use-prism-theme'
910; ( typeof global !== 'undefined' ? global : window ) . Prism = Prism
1011require ( 'prismjs/components/prism-bash' )
1112
@@ -99,9 +100,10 @@ const CodeBlock = ({children, code, className, style}) => (
99100)
100101
101102function Code ( { className = '' , prompt, children} ) {
103+ const { theme : codeTheme } = usePrismTheme ( )
102104 if ( prompt ) {
103105 return (
104- < CodeBlock style = { themes . github . plain } >
106+ < CodeBlock style = { codeTheme . plain } >
105107 < MonoText > { children } </ MonoText >
106108 </ CodeBlock >
107109 )
@@ -115,7 +117,7 @@ function Code({className = '', prompt, children}) {
115117 }
116118
117119 return (
118- < Highlight code = { code } language = { className . replace ( / l a n g u a g e - / , '' ) || 'bash' } theme = { themes . github } >
120+ < Highlight code = { code } language = { className . replace ( / l a n g u a g e - / , '' ) || 'bash' } theme = { codeTheme } >
119121 { ( { className : highlightClassName , style, tokens, getLineProps, getTokenProps} ) => (
120122 < CodeBlock className = { highlightClassName } style = { style } code = { code } >
121123 { tokens . map ( ( line , i ) => (
0 commit comments