Getting Started
This guide covers installation and basic usage of BrandKit.
Installation
CLI Tool
Install the CLI using Go:
The binary is named brandkit. Verify installation:
Go Library
Add BrandKit to your Go project:
Quick Start
Creating White Icons
The most common workflow is converting a color icon to white on a transparent background:
This command:
- Removes any solid background
- Converts all colors to white (
#ffffff) - Centers the content in the viewBox
- Verifies the output is pure vector
- Scans for security threats
Creating Color Icons
To create a centered icon preserving original colors:
Security Scanning
Scan SVG files for potential security threats:
# Scan a single file
brandkit security-scan icon.svg
# Scan a directory
brandkit security-scan brands/
# Generate JSON report
brandkit security-scan brands/ --report=security-report.json
Verification
Verify that SVG files are pure vector (no embedded raster data):
Using as a Library
Color Conversion
package main
import (
"fmt"
"github.com/grokify/brandkit/svg/convert"
)
func main() {
result, err := convert.SVG("input.svg", "output.svg", convert.Options{
Color: "ffffff",
RemoveBackground: true,
IncludeStroke: true,
PreserveMasks: true,
})
if err != nil {
panic(err)
}
fmt.Printf("Converted: %s\n", result.OutputPath)
}
Security Scanning
package main
import (
"fmt"
"github.com/grokify/brandkit/svg/security"
)
func main() {
result, err := security.SVG("icon.svg")
if err != nil {
panic(err)
}
if result.IsSecure {
fmt.Println("No threats detected")
} else {
for _, threat := range result.Threats {
fmt.Printf("Threat: %s (%s)\n", threat.Description, threat.Type)
}
}
}
Verification
package main
import (
"fmt"
"github.com/grokify/brandkit/svg/verify"
)
func main() {
result, err := verify.SVG("icon.svg")
if err != nil {
panic(err)
}
if result.IsSuccess() {
fmt.Println("Pure vector SVG")
} else {
for _, issue := range result.Issues {
fmt.Printf("Issue: %s\n", issue)
}
}
}
Next Steps
- CLI Reference — Learn all available commands
- Library API — Explore the Go packages
- Security Guide — Understand threat detection