How do I change the theme for code block in Confluence Cloud?

CK CK 3788 
Created at  
1,358 0 0

I wanted to change the code block theme in Confluence Cloud for better visibility based on a black background and white text color. And found the below approach.

Before reading the whole post, I want to let you know that you cannot directly change the global code block theme in Confluence Cloud using native Confluence settings or custom CSS. Actually, the Confluence standard provides that feature.

As an alternative solution, Confluence Cloud offers a built-in "Dark" theme for its code block macro, which provides a black background with white or light-colored text, perfect for better visibility, especially if you're working with a dark desktop theme or prefer high contrast.

Here's a guide on how to change the code block theme in Confluence Cloud:

 

Method 1: Using Confluence's Built-in "Dark" Theme (Recommended)

This is the easiest and most direct way to get a black background and white text for your code blocks.

1. Edit Your Confluence Page:

  • Navigate to the Confluence page where you want to change the code block theme.
  • Click the "Edit" button (pencil icon) in the top right corner of the page.

2. Locate or Insert a Code Block Macro:

  • If you already have a code block: Click on the existing code block macro to select it.
  • If you need to insert a new one: Type /code and select "Code snippet" from the suggestion list, or click the "+" (Insert more content) icon in the editor toolbar and search for "Code snippet."

3. Access Macro Settings:

  • Once the code block macro is selected, a small toolbar will appear directly above or below it.
  • Look for the "Theme" dropdown menu within this toolbar. By default, it's often set to "Confluence" or "Default."

(Example of what the toolbar might look like)
[ Language: Java ▼ ] [ Theme: Confluence ▼ ] [ Show line numbers ] [ Copy ]

 

4. Select the "Dark" Theme:

  • Click the "Theme" dropdown.
  • From the list of available themes, select "Dark."

You should immediately see the code block's background change to black and the text to a lighter color.

 

5. Adjust Language (Optional but Recommended):

  • Next to the "Theme" dropdown, there's usually a "Language" dropdown.
  • Select the correct programming language (e.g., Java, Python, HTML, JavaScript, Plain Text) for proper syntax highlighting. This will ensure keywords, strings, and comments are colored appropriately against the dark background.

6. Save or Publish Your Page:

  • Once you're happy with the changes, click "Publish" (if it's a new page or a major edit) or "Update" (if it's an existing page) in the top right corner of the editor.

 

 

Method 2: Using a Third-Party App (For More Customization)

 

If Confluence's built-in "Dark" theme isn't exactly what you're looking for, or you need more control over colors and styles, you might consider a third-party app from the Atlassian Marketplace. These apps often provide a wider range of themes, including more dark options, and sometimes custom CSS capabilities.

Examples of Apps:

  • Advanced Code Macro: Offers more syntax highlighting options and themes.
  • Code Block Pro for Confluence: Provides additional themes, line highlighting, and other features.

Steps:
1. Consult Your Confluence Administrator: Installing new apps requires administrator privileges. Discuss your needs with your Confluence admin.
2. Browse the Atlassian Marketplace: Your administrator can go to Settings (gear icon) > Apps > Find new apps and search for "code block" or "syntax highlighting."
3. Install the App: Your administrator will install the chosen app.
4. Use the App's Specific Macro: Once installed, the app will likely provide its own code block macro (e.g., /advanced code, /code block pro).
5. Configure Theme within the App's Macro: When you insert or edit the app's macro, it will have its own set of theme options, which might include more dark themes or even allow custom color schemes. Follow the app's specific documentation for configuration.

 

Important Considerations:

  • Consistency: For the best reader experience, try to maintain a consistent code block theme across your Confluence space or within related documentation.
  • Accessibility: While a dark theme can be great for many, ensure it doesn't negatively impact users with certain visual impairments. High contrast is generally good, but extreme color combinations can sometimes be problematic.
  • Confluence Cloud Limitations: Unlike Confluence Server/Data Center, Confluence Cloud does not allow end-users to directly inject custom CSS to override styles. Your options are limited to the built-in themes or themes provided by marketplace apps.

By following Method 1, you should easily achieve the desired black background and white text for your code blocks in Confluence Cloud, significantly improving visibility.

Tags Code Block Theme Confluence Confluence Cloud Confluence Code Block Confluence Theme Facebook X
Comments 0
  1. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    86
  2. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    153
  3. System Requirements and Architecture: Intelligent Priority-Based Scheduler
    161
  4. Messaging Platform with Limited TPS based on the vendor
    194
  5. Redis vs Memcached: Why Enterprise Tech Giants Choose Redis
    247
  6. ETL vs ELT what makes the differeence? Why MLOps leverage ELT?
    192
  7. Arm Kernel DNNs: Powering Efficient AI at the Edge
    221
  8. Cloud-Native Capital Markets: Architecture, Compliance, and Innovation
    210
  9. Add New Address to gmail without SMTP (forwarding-only-address)
    1,676
  10. Registering an App on the Google Play Store
    1,456
  11. AGENT.md: AI's Blueprint for Robust Software and Vibe Coding
    545
  12. Tailscale: Zero-Config Remote Access to Your Home PC, Firewall-Free
    529
  13. Markdown's Visual Revolution: Meet Mermaid.js
    408
  14. Viewing Git Graph in ASCII
    586
  15. Vibe Coding: Harmonizing Intent with AI Productivity
    494
  16. FIPS - Federal Information Processing Standards
    1,388
  17. Simplify Your Workflow: Switching Git Profiles Automatically by Folder
    745
  18. How to Control External Monitor Brightness, Sound Volume on a Mac with MonitorControl (Even Over HDMI)
    2,389
  19. Building Multilingual Applications with i18n
    1,196
  20. Kiro versus Cursor AI - Spec-Driven? or Chat-Driven?
    400
  21. How to use multiple RSA (SSH) keys for GitHub
    321
  22. Key Metrics Track to Ensure the Health and Performance of a Distributed System
    172
  23. REST API Vs. GraphQL
    408
  24. Project Libre similar to MS Project
    526
  25. Learning about Firestore: Architecture, Pros, Cons, and Real-World Deployments
    165
  26. Building Privacy-First Infrastructure: Network Isolation + Zero Trust for GDPR Compliance
    289
  27. Why supabase is not safe for the Fintech project?
    854
  28. The Ultimate Data Engineering Roadmap
    1,069
  29. Nine Types of Testing while we develop APIs
    511
  30. Apache Kafka - a distributed, fault-tolerant, high-throughput streaming platform
    613
Recently updated
  1. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    27
  2. Why SPF and DKIM Are Essential for Linux Email Servers?
    24
  3. How do I create animated background for Google Meet?
    19,731
  4. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    217
  5. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    86
  6. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    153
  7. Array of arguments passed to script in PHP
    85
  8. Invalid Auction Storms in Ad Tech
    93
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    198
  10. The Two Clocks of Ad Server Architecture
    63
  11. Frequency Cap Architecture Overview
    509
  12. Collecting Proof-of-Play from 100,000 Screens
    141
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    280
  14. What is RedisVL?
    105
  15. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    224
  16. TPU & GPU Cluster Management Tools
    234
  17. The Concept of Scaffolding in AI Agents
    222
  18. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    576
  19. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    253
  20. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    328
  21. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    197
  22. Machine Learning: Training vs. Ranking
    213
  23. The Continuous Learning Machine: Designing a Loop That Actually Turns
    217
  24. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    189
  25. Designing a Data Curation System Around a Vector Database
    215
  26. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    229
  27. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    649
  28. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    185
  29. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    207
  30. Understanding Data Lineage
    252