Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgrayisok committed Dec 18, 2018
0 parents commit 9c07268
Show file tree
Hide file tree
Showing 34 changed files with 11,840 additions and 0 deletions.
1 change: 1 addition & 0 deletions .craftplugin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"pluginName":"Dark Mode","pluginDescription":"A Dark Mode for Craft CMS","pluginVersion":"1.0.0","pluginAuthorName":"Matt Gray","pluginVendorName":"mattgrayisok","pluginAuthorUrl":"https://mattgrayisok.com","pluginAuthorGithub":"mattgrayisok","codeComments":"","pluginComponents":[],"consolecommandName":"","controllerName":"","cpsectionName":"","elementName":"","fieldName":"","modelName":"","purchasableName":"","recordName":"","serviceName":"","taskName":"","utilityName":"","widgetName":"","apiVersion":"api_version_3_0"}
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# CRAFT ENVIRONMENT
.env.php
.env.sh
.env

# COMPOSER
/vendor

# BUILD FILES
/bower_components/*
/node_modules/*
/build/*
/yarn-error.log

# MISC FILES
.cache
.DS_Store
.idea
.project
.settings
*.esproj
*.sublime-workspace
*.sublime-project
*.tmproj
*.tmproject
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
config.codekit3
prepros-6.config
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Dark Mode Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 1.0.0 - 2018-12-18
### Added
- Initial release
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2018 Matt Gray

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Dark Mode plugin for Craft CMS 3.x

A Dark Mode for Craft CMS

![Screenshot](resources/img/plugin-logo.png)

## Requirements

This plugin requires Craft CMS 3.0.0 or later.

## Installation

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

cd /path/to/project

2. Then tell Composer to load the plugin:

composer require mattgrayisok/craft-dark-mode

3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Dark Mode.

## Dark Mode Overview

Sometimes you just need a little less light and a little more shade.

## Dark Mode Roadmap

* Allow dark mode to be [de]activated using a switch in the nav

Brought to you by [Matt Gray](https://mattgrayisok.com)

---

Icon made by Freepik from https://www.flaticon.com/
40 changes: 40 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "mattgrayisok/craft-dark-mode",
"description": "A Dark Mode for Craft CMS",
"type": "craft-plugin",
"version": "1.0.0",
"keywords": [
"craft",
"cms",
"craftcms",
"craft-plugin",
"dark mode"
],
"support": {
"docs": "https://github.com/mattgrayisok/craft-dark-mode/blob/master/README.md",
"issues": "https://github.com/mattgrayisok/craft-dark-mode/issues"
},
"license": "MIT",
"authors": [
{
"name": "Matt Gray",
"homepage": "https://mattgrayisok.com"
}
],
"require": {
"craftcms/cms": "^3.0.0"
},
"autoload": {
"psr-4": {
"mattgrayisok\\darkmode\\": "src/"
}
},
"extra": {
"name": "Dark Mode",
"handle": "craft-dark-mode",
"hasCpSettings": false,
"hasCpSection": false,
"changelogUrl": "https://raw.githubusercontent.com/mattgrayisok/craft-dark-mode/master/CHANGELOG.md",
"class": "mattgrayisok\\darkmode\\DarkMode"
}
}
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "darkmode",
"version": "1.0.0",
"description": "Dark Mode for Craft CMS",
"main": "index.js",
"repository": "https://github.com/mattgrayisok/craft-dark-mode",
"author": "Matt Gray",
"license": "MIT",
"devDependencies": {
"node-sass": "^4.11.0"
},
"scripts": {
"build": "./node_modules/.bin/node-sass --output-style compressed ./src/assetbundles/darkmode/src/craft/craft.scss > ./src/assetbundles/darkmode/dist/css/DarkMode.css"
}
}
Binary file added resources/img/plugin-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
98 changes: 98 additions & 0 deletions src/DarkMode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php
/**
* Dark Mode plugin for Craft CMS 3.x
*
* A Dark Mode for Craft CMS
*
* @link https://mattgrayisok.com
* @copyright Copyright (c) 2018 Matt Gray
*/

namespace mattgrayisok\darkmode;

use mattgrayisok\darkmode\models\Settings;
use mattgrayisok\darkmode\assetbundles\DarkMode\DarkModeAsset;

use Craft;
use craft\base\Plugin;
use craft\services\Plugins;
use craft\events\PluginEvent;

use yii\base\Event;

/**
* Class DarkMode
*
* @author Matt Gray
* @package DarkMode
* @since 1.0.0
*
*/
class DarkMode extends Plugin
{
// Static Properties
// =========================================================================

/**
* @var DarkMode
*/
public static $plugin;

// Public Properties
// =========================================================================

/**
* @var string
*/
public $schemaVersion = '1.0.0';

// Public Methods
// =========================================================================

/**
* @inheritdoc
*/
public function init()
{
parent::init();
self::$plugin = $this;

if ( Craft::$app->request->isCpRequest && !Craft::$app->user->isGuest )
{
$this->view->registerAssetBundle(DarkModeAsset::class);
}

Craft::info(
Craft::t(
'craft-dark-mode',
'{name} plugin loaded',
['name' => $this->name]
),
__METHOD__
);
}

// Protected Methods
// =========================================================================

/**
* @inheritdoc
*/
/*protected function createSettingsModel()
{
return new Settings();
}*/

/**
* @inheritdoc
*/
/*protected function settingsHtml(): string
{
return Craft::$app->view->renderTemplate(
'craft-dark-mode/settings',
[
'settings' => $this->getSettings()
]
);
}*/
}
48 changes: 48 additions & 0 deletions src/assetbundles/darkmode/DarkModeAsset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Dark Mode plugin for Craft CMS 3.x
*
* A Dark Mode for Craft CMS
*
* @link https://mattgrayisok.com
* @copyright Copyright (c) 2018 Matt Gray
*/

namespace mattgrayisok\darkmode\assetbundles\DarkMode;

use Craft;
use craft\web\AssetBundle;
use craft\web\assets\cp\CpAsset;

/**
* @author Matt Gray
* @package DarkMode
* @since 1.0.0
*/
class DarkModeAsset extends AssetBundle
{
// Public Methods
// =========================================================================

/**
* @inheritdoc
*/
public function init()
{
$this->sourcePath = "@mattgrayisok/darkmode/assetbundles/darkmode/dist";

$this->depends = [
CpAsset::class,
];

$this->js = [
'js/DarkMode.js',
];

$this->css = [
'css/DarkMode.css',
];

parent::init();
}
}
1 change: 1 addition & 0 deletions src/assetbundles/darkmode/dist/css/DarkMode.css

Large diffs are not rendered by default.

Loading

0 comments on commit 9c07268

Please sign in to comment.