Swiftpack.co - SpectralDragon/CodeSyntaxCSSGeneratorPlugin as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by SpectralDragon.
SpectralDragon/CodeSyntaxCSSGeneratorPlugin 0.2.0
A Publish plugin that generates a syntax code css styles for you Splash Plugin from Xcode Color Theme.
⭐️ 9
🕓 50 weeks ago
macOS
.package(url: "https://github.com/SpectralDragon/CodeSyntaxCSSGeneratorPlugin.git", from: "0.2.0")

CodeSyntaxCSSGeneratorPlugin

A Publish plugin that generates a syntax code css styles for you Splash Plugin from Xcode Color Theme.

Swift 5.1 Publish

Install

To install it into your Publish package, add it as a dependency within your Package.swift manifest:

let package = Package(
    ...
    dependencies: [
        ...
        .package(url: "https://github.com/SpectralDragon/CodeSyntaxCSSGenerator.git", from: "0.1.0")
    ],
    targets: [
        .target(
            ...
            dependencies: [
                ...
                "CodeSyntaxCSSGeneratorPlugin"
            ]
        )
    ]
    ...
)

Usage

Move dvtcolortheme or xccolortheme file to Resource dirictory and intall the plugin in any place in build step.


// My xcode theme `Light.dvtcolortheme`

import CodeSyntaxCSSGeneratorPlugin

Site().publish(using: [
    .installPlugin(
        .generateCodeCSS(withClassPrefix: "pre code .s-",
                         theme: .xcode("Light.dvtcolortheme"))
    ),
])

after that, the plugin will generate codesyntax.css file

pre code .s-preprocessing {
    color: #63381FFF
}

pre code .s-comment {
    color: #007400FF
}

pre code .s-number {
    color: #1C00CEFF
}

pre code .s-call {
    color: #25464AFF
}

pre code .s-property {
    color: #3E6D74FF
}

pre code .s-keyword {
    color: #A90D91FF
}

pre code .s-dotAccess {
    color: #25464AFF
}

pre code .s-type {
    color: #3E6D74FF
}

pre code .s-string {
    color: #C41A15FF
}

Also plugin can generate css to dark scheme, just use CodeTheme.dynamic(light: CodeTheme, dark: CodeTheme) case. The plugin add @media(prefers-color-scheme: dark) with passed code theme.

Features

  • ☐ intellij theme
  • ☐ VSCode

Thank you and enjoy 💯

GitHub

link
Stars: 9
Last commit: 50 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics