Skip to content

Commit 389cba9

Browse files
chore: initial commit
0 parents  commit 389cba9

File tree

19 files changed

+404
-0
lines changed

19 files changed

+404
-0
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.gitattributes

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Git
2+
.github/ export-ignore
3+
.gitattributes export-ignore
4+
.gitignore export-ignore
5+
6+
# Source files
7+
src/panel/ export-ignore
8+
9+
# Development files
10+
.vscode/ export-ignore
11+
.editorconfig export-ignore
12+
eslint.config.mjs export-ignore
13+
package.json export-ignore

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: bogdancondorachi

.github/ISSUE_TEMPLATE/bug.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: 🐛 Bug Report
3+
about: Report if something isn't working as expected
4+
title: 'Bug: '
5+
labels: 'type: bug 🐛'
6+
assignees: 'bogdancondorachi'
7+
---
8+
9+
## Description
10+
11+
## Steps to Reproduce
12+
1. Go to '...'
13+
2. Click on '...'
14+
3. See error
15+
16+
## Screenshots
17+
18+
## Environment:
19+
- **Browser:** [e.g. Chrome, Firefox, Safari]
20+
- **Plugin Version:** [e.g. 2.4.0]
21+
- **Kirby Version:** [e.g. 4.4.1, 4.3.8]
22+
23+
## Additional Context
24+
- **Field Blueprint:**
25+
- **Field Content:**

.github/ISSUE_TEMPLATE/feature.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: 🎉 Feature Request
3+
about: Suggest an idea for a new feature
4+
title: 'Feature Request: '
5+
labels: 'type: feature 🎉'
6+
assignees: 'bogdancondorachi'
7+
---
8+
9+
## Summary
10+
11+
## Why is this feature needed?

.github/README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Kirby Colour Swatch Field
2+
3+
> [!NOTE]
4+
> A simple color field extention that allows to pass options like 'hex', 'class' or 'title' for [Kirby CMS](https://getkirby.com).
5+
6+
## 📦 Installation
7+
8+
### Composer
9+
```bash
10+
composer require bogdancondorachi/kirby-colour-swatch-field
11+
```
12+
13+
### Git Submodule
14+
```bash
15+
git submodule add https://github.com/bogdancondorachi/kirby-colour-swatch-field.git site/plugins/colour-swatch-field
16+
```
17+
18+
### Manual
19+
[Download the plugin](https://api.github.com/repos/bogdancondorachi/kirby-colour-swatch-field/zipball) and extract it to: `/site/plugins/colour-swatch-field`
20+
21+
## ⚙️ Usage
22+
23+
### Add the field to your blueprint:
24+
25+
```yaml
26+
bgColor:
27+
label: Background Color
28+
type: swatch
29+
options:
30+
amber:
31+
hex: 'FFB900'
32+
title: Amber
33+
class: bg-amber-400
34+
emerald:
35+
hex: '009966'
36+
title: Apricot
37+
class: bg-emerald-600
38+
white:
39+
hex: 'FFFFFF'
40+
title: White
41+
class: bg-white
42+
black:
43+
hex: '000000'
44+
title: Black
45+
class: bg-black
46+
```
47+
48+
### Use the field in your template:
49+
50+
```php
51+
// Outputs the selected color title as a string
52+
$page->bgColor()->toSwatch('title')
53+
54+
// Outputs the selected color hex code as a string (without preceding #)
55+
$page->bgColor()->toSwatch('hex')
56+
57+
// Outputs the selected color class as a string
58+
$page->bgColor()->toSwatch('class')
59+
```
60+
61+
## 🙏 Credits
62+
- [Chris Martin](https://github.com/chrisbeluga) for his [Kirby Color Selection](https://github.com/chrisbeluga/kirby-colors), which served as base for this project.
63+
64+
## 📜 License
65+
[MIT License](./LICENSE) Copyright © 2024 [Bogdan Condorachi](https://github.com/bogdancondorachi)

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# OS files
2+
.DS_Store
3+
4+
# Development files
5+
/node_modules
6+
/vendor
7+
/tests
8+
9+
# Temporary files
10+
index.dev.mjs
11+
composer.lock
12+
package-lock.json

.vscode/settings.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
// Disable the default formatter, use eslint instead
3+
"prettier.enable": false,
4+
"editor.formatOnSave": false,
5+
6+
// Auto fix
7+
"editor.codeActionsOnSave": {
8+
"source.fixAll.eslint": "explicit",
9+
"source.organizeImports": "never"
10+
},
11+
12+
// Silent the stylistic rules in you IDE, but still auto fix them
13+
"eslint.rules.customizations": [
14+
{ "rule": "style/*", "severity": "off", "fixable": true },
15+
{ "rule": "format/*", "severity": "off", "fixable": true },
16+
{ "rule": "*-indent", "severity": "off", "fixable": true },
17+
{ "rule": "*-spacing", "severity": "off", "fixable": true },
18+
{ "rule": "*-spaces", "severity": "off", "fixable": true },
19+
{ "rule": "*-order", "severity": "off", "fixable": true },
20+
{ "rule": "*-dangle", "severity": "off", "fixable": true },
21+
{ "rule": "*-newline", "severity": "off", "fixable": true },
22+
{ "rule": "*quotes", "severity": "off", "fixable": true },
23+
{ "rule": "*semi", "severity": "off", "fixable": true }
24+
],
25+
26+
// Enable eslint for all supported languages
27+
"eslint.validate": [
28+
"javascript",
29+
"typescript",
30+
"vue",
31+
"markdown",
32+
"json",
33+
"yaml",
34+
"css",
35+
"scss"
36+
]
37+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Bogdan Condorachi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

composer.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "bogdancondorachi/kirby-colour-swatch-field",
3+
"description": "Colour swatch field for Kirby CMS",
4+
"type": "kirby-plugin",
5+
"license": "MIT",
6+
"version": "1.0.0",
7+
"homepage": "https://github.com/bogdancondorachi/kirby-colour-swatch-field",
8+
"authors": [
9+
{
10+
"name": "Bogdan Condorachi",
11+
"email": "[email protected]",
12+
"homepage": "https://plugins.getkirby.com/bogdancondorachi"
13+
}
14+
],
15+
"require": {
16+
"php": ">=8.2.0 <8.5.0",
17+
"getkirby/composer-installer": "^1.2"
18+
},
19+
"config": {
20+
"allow-plugins": {
21+
"getkirby/composer-installer": true
22+
}
23+
},
24+
"conflict": {
25+
"getkirby/cms": "<4.0 || >=6.0"
26+
},
27+
"extra": {
28+
"installer-name": "colour-swatch-field"
29+
}
30+
}

0 commit comments

Comments
 (0)