Ahmad Awais

NAVIGATE


SHARE


Syntax Highlighting with Shades of Purple theme in WordPress

Ahmad AwaisAhmad Awais

This post will help you add Shades of Purple syntax highlighting to your WordPress blog. I plan to actually sit down and write a custom WordPress plugin to do just that.

Due to the lack of time, I’ve had to use this hacky setup that is not as optimized as I like it to be, but heck, it does work.

Step #0: What are we going to do?#

I will install a WordPress plugin to support both a syntax highlighter and Prism.js so that we can use the CSS version of Shades of Purple for Prism.js. Following is what the Shades of Purple syntax highlighting looks like.

/**
 * Shades of purple can be genius
 *
 * @param String hello Hello.
 * @since 1.0.0
 */

// String.
const sop = '🦄 Shades of Purple is an awesome syntax highlighting theme.';
console.log('sop', sop);

/**
 * Speed SVG CSS.
 *
 * @param Number one Angle to rotate the SVG.
 * @param Number two Angle to rotate the SVG.
 * @param Number three Angle to rotate the SVG.
 */
export const speedCSS = (one, two, three) => {
	btnBarSvgSpeed.css({
		transform: `rotate(${one}deg)`,
		transform: `rotate(${two}deg)`,
		transform: `rotate(${three}deg)`
	});
};

// Conditionals.
if (ahmad) {
	console.log('Ahmad loves open source');
} else if (awais) {
	console.log('Awais is making Shades of Purple');
} else {
	console.log(`Call it SOP for brevity`);
}

Step #1: Install APH Prism Syntax Highlighter#

Prism.js is one of the most popular syntax highlighters widely used by many blogs or websites; some of them are popular websites, such as Mozilla, drupal, and SitePoint.

This plugin helps you add Prism.js based syntax-highlighting to your WordPress easily, provided with many features and a user-friendly GUI, making it handy and easy to use. Though, it only works in the TEXT mode and of the Classic WordPress editor.

Step #2: Add Shades of Purple CSS#

After installing the APH Prism Syntax Highlighter plugin, go to Settings ❯ Prism Highlighter Menu and configure the plugin.

This is it. Now create a new post; select the TEXT tab instead of the VISUAL one when you are adding the code. I know it’s hacky. But this is it for now until I or someone builds a simple WordPress plugin to handle all this. I hope you and your readers enjoy high-quality syntax highlighting.

Peace! ✌️

Founder & CEO of ⌘ Command Code, the most used coding agent for open models: 160K+ users, 50K+ paying customers. Founded Langbase (AI cloud for agents with memory & tools).

"What an awesome example for developers." — Satya Nadella, CEO of Microsoft, on my NASA Ingenuity code.

NASA Ingenuity Mars Helicopter code contributor · 6× GitHub Star, one of the first 8 Gold Stars · #1 trending JavaScript developer on GitHub · 6× Google Developer Expert · 6× Microsoft MVP.

Ex VP DevRel & DevTools at RapidAPI · Google Developers Advisory Board (gDAB) founding member · OpenAPI Business Governing Board, Linux Foundation · SF DevNetwork AI/ML Advisory Board · Angel investor (Replit, Resend, Daytona, Gumroad and you?).

Award-winning open source engineering leader: 300+ projects, 50–100M downloads a year, including Shades of Purple (5M+ developers) and corona-cli (10B+ queries).

Taught 217K+ developers via NodeCLI.com and VSCode.pro. 160+ talks. Blogging since 2000, billions of views.

❯ Read more about Ahmad Awais or come say hi on 𝕏 @MrAhmadAwais.

Newsletter

The Developer Takeaway

Founder notes on AI, dev tools, and building developer products. No spam.

247,813+ developers subscribed
Comments 0
There are currently no comments.