Skip to content

Legibility of (Python) code, and alignment in default #412

Answered by yhatt
dcbbdc asked this question in Q&A
Discussion options

You must be logged in to vote

Is there a way to influence the background color of the code, or the colors of the code formatting?

Yes, you can override code colors by tweaking style through <style> tag in Markdown.

---
theme: gaia
---

<style>
/* Change background color of the code block to black */
pre {
  background-color: #000;
}

/* Change foreground color of params in the code to pink */
.hljs-params {
  color: #f9c;
}
</style>

```python
@requires_authorization(roles=["ADMIN"])
def somefunc(param1='', param2=0):
    r'''A docstring'''
    if param1 > param2: # interesting
        print 'Gre\'ater'
    return (param2 - param1 + 1 + 0b10l) or None

class SomeClass:
    pass

>>> message = '''interpreter
... prompt

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dcbbdc
Comment options

Answer selected by dcbbdc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants