Page Menu
Home
Wolfplex
Search
Configure Global Search
Log In
Files
F408421
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Subscribers
None
View Options
diff --git a/design/kibaone/accents/KibaOneAccents.php b/design/kibaone/accents/KibaOneAccents.php
new file mode 100644
index 0000000..61dac61
--- /dev/null
+++ b/design/kibaone/accents/KibaOneAccents.php
@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * Wolfplex Kiba One design available accents
+ */
+class KibaOneAccents {
+ /**
+ * @var string The color to use like a white
+ */
+ const WHITE = '#ffffff'; //We currently don't consider a grayish white for cyan compliance.
+
+ /**
+ * @var string The color to use like a black
+ */
+ const BLACK = '#000000'; //We currently don't consider a dark gray for citron compliance.
+
+ /**
+ * Gets the accents
+ *
+ * @return array An array of all available accents, each item an array of three strings: the accent name, the accent
+ */
+ public static function getAccents () {
+ return [
+ // Main colors
+ [ 'black', '#000000', '#4b4b50' ],
+ [ 'zedgray', '#343434', static::WHITE ],
+ [ 'bluegray', '#4b4b50', static::WHITE ],
+
+ // Colored accents
+ [ 'cyan', '#2ba6cb', static::WHITE ],
+ [ 'lime', '#e7fb03', static::BLACK ],
+ [ 'magenta', '#f608b0', static::WHITE ],
+ [ 'craie', '#f3f3f3', static::BLACK ],
+ [ 'grenade', '#f34723', static::WHITE ],
+ [ 'sorbier', '#fb8507', static::WHITE ],
+ [ 'purple', '#998cfb', static::WHITE ],
+ [ 'citron', '#fcff00', static::BLACK ],
+ [ 'blueribbon', '#1d62ff', static::WHITE ],
+ [ 'red', '#f60000', static::WHITE ],
+ ];
+ }
+
+ /**
+ * Determines if an accent exists
+ *
+ * @param string $accent The name fo the accent to determine the existence
+ * @return boolean true if the accent exists ; otherwise, false
+ */
+ public static function exists ($accentName) {
+ foreach (static::getAccents() as $candidateAccent) {
+ if ($candidateAccent[0] == $accentName) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Gets a color from the specified accent
+ *
+ * @param string $accentName The name of the accent
+ * @param int $index the color index (0 for accent, 1 for headings)
+ * @return string The accent's requested color
+ */
+ protected static function getColor ($accentName, $index) {
+ ++$index;
+ foreach (static::getAccents() as $candidateAccent) {
+ if ($candidateAccent[0] == $accentName) {
+ return $candidateAccent[$index];
+ }
+ }
+ throw new InvalidArgumentException("The accent doesn't exist: $accentName");
+ }
+
+ /**
+ * Gets the accent color
+ *
+ * @param string $accentName The name of the accent
+ * @return string The accent color
+ */
+ public static function getAccentColor ($accentName) {
+ return static::getColor($accentName, 0);
+ }
+
+ /**
+ * Gets the headings color
+ *
+ * @param string $accentName The name of the accent
+ * @return string The headings color
+ */
+ public static function getHeadingsColor ($accentName) {
+ return static::getColor($accentName, 1);
+ }
+}
diff --git a/design/kibaone/accents/index.php b/design/kibaone/accents/index.php
index 4ec61a9..462711f 100755
--- a/design/kibaone/accents/index.php
+++ b/design/kibaone/accents/index.php
@@ -1,45 +1,32 @@
<?php
/**
* Wolfplex Kiba One design available accents
*
* Outputs an array of accents:
* name: accent name
* accent: background color
* headingColor: text color
*/
-$white = '#ffffff'; //We currently don't consider a grayish white for cyan compliance.
-$black = '#000000'; //We currently don't consider a dark gray for citron compliance.
-$defaultHeadingsColor = $white;
+require('KibaOneAccents.php');
-$accents = [
- // Main colors
- [ 'black', '#000000', '#4b4b50' ],
- [ 'zedgray', '#343434' ],
- [ 'bluegray', '#4b4b50' ],
+///
+/// Prepares API resources
+///
- // Colored accents
- [ 'cyan', '#2ba6cb' ],
- [ 'lime', '#e7fb03', $black ],
- [ 'magenta', '#f608b0' ],
- [ 'craie', '#f3f3f3', $black ],
- [ 'grenade', '#f34723' ],
- [ 'sorbier', '#fb8507' ],
- [ 'purple', '#998cfb' ],
- [ 'citron', '#fcff00', $black ],
- [ 'blueribbon', '#1d62ff' ],
- [ 'red', '#f60000' ],
-];
-
-$areas = [];
-foreach ($accents as $accent) {
- $areas[] = [
+$accents = [];
+foreach (KibaOneAccents::getAccents() as $accent) {
+ $accents[] = [
'name' => $accent[0],
'accent' => $accent[1],
- 'headingColor' => count($accent) < 3 ? $defaultHeadingsColor : $accent[2]
+ 'headingColor' => $accent[2]
];
}
+///
+/// API output
+///
+
header("Content-Type: application/json");
-echo json_encode($areas, JSON_PRETTY_PRINT);
+echo json_encode($accents, JSON_PRETTY_PRINT);
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Jun 9, 12:14 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
46306
Default Alt Text
(4 KB)
Attached To
rAPI Wolfplex API
Event Timeline
Log In to Comment