Skip to content

Commit

Permalink
Update version to 1.1.0
Browse files Browse the repository at this point in the history
Add saturate and Lightness default value
  • Loading branch information
ShahroozD committed Oct 20, 2014
1 parent a48a24c commit 3198e04
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 8 deletions.
11 changes: 10 additions & 1 deletion README.md
Expand Up @@ -66,4 +66,13 @@ This ACF field type is compatible with:
4. Please refer to the description for more info regarding the field type settings

### Changelog
Please see `readme.txt` for changelog

## 1.1.0 ##
* Add saturate and Lightness default value
* Bug fix: Hue Label
* bug fix: load more than a field
* bug fix: 0 value

## 1.0.0 ##
* Initial Release.

28 changes: 22 additions & 6 deletions acf-hue-v5.php
Expand Up @@ -48,6 +48,8 @@ function __construct() {

$this->defaults = array(
'hue_default' => 199,
'Lightness' => 50,
'saturate' => 100,
);


Expand Down Expand Up @@ -99,6 +101,20 @@ function render_field_settings( $field ) {
'name' => 'hue_default',
));

acf_render_field_setting( $field, array(
'label' => __('saturate Default Value','acf-hue-color-picker'),
'type' => 'number',
'append' => '%',
'name' => 'saturate',
));

acf_render_field_setting( $field, array(
'label' => __('Lightness Default Value','acf-hue-color-picker'),
'type' => 'number',
'append' => '%',
'name' => 'Lightness',
));

}


Expand Down Expand Up @@ -216,9 +232,9 @@ function render_field( $field ) {
slide: function( event, ui ) {
var hslColor = '';
if (ui.value == 0) {
hslColor = 'hsl(' + ui.value + ', 0%, 50%)';
hslColor = 'hsl(' + ui.value + ', 0%, " . $field['Lightness'] . "%)';
} else {
hslColor = 'hsl(' + ui.value + ', 80%, 50%)';
hslColor = 'hsl(' + ui.value + ', " . $field['saturate'] . "%, " . $field['Lightness'] . "%)';
}
$(amount_hue_id).css('background-color',hslColor)
Expand All @@ -229,19 +245,19 @@ function render_field( $field ) {
$(amount_hue_id).on('change',function () {
$( hue_slider_range_max_id ).slider('value' , $( amount_hue_id ).val());
if ($( amount_hue_id ).val() == 0) {
$(amount_hue_id).css('background-color','hsl(' + $( hue_slider_range_max_id ).slider( 'value' ) + ',0%,50%)');
$(amount_hue_id).css('background-color','hsl(' + $( hue_slider_range_max_id ).slider( 'value' ) + ',0%," . $field['Lightness'] . "%)');
} else {
$(amount_hue_id).css('background-color','hsl(' + $( hue_slider_range_max_id ).slider( 'value' ) + ',100%,50%)');
$(amount_hue_id).css('background-color','hsl(' + $( hue_slider_range_max_id ).slider( 'value' ) + '," . $field['saturate'] . "%," . $field['Lightness'] . "%)');
}
})
$( hue_slider_range_max_id ).slider( 'value', $( amount_hue_id).val());
if ($( amount_hue_id ).val() != 0) {
$(amount_hue_id).css('background-color','hsl(' + $( amount_hue_id ).val() + ',100%,50%)')
$(amount_hue_id).css('background-color','hsl(' + $( amount_hue_id ).val() + '," . $field['saturate'] . "%," . $field['Lightness'] . "%)')
} else {
$(amount_hue_id).css('background-color','hsl(' + $( amount_hue_id ).val() + ',0%,50%)')
$(amount_hue_id).css('background-color','hsl(' + $( amount_hue_id ).val() + ',0%," . $field['Lightness'] . "%)')
}
});
Expand Down
2 changes: 1 addition & 1 deletion acf-hue.php
Expand Up @@ -4,7 +4,7 @@
Plugin Name: Advanced Custom Fields: Hue Color Picker
Plugin URI: https://github.com/reyhoun/acf-hue-color-picker
Description: It's a field that user can choose Color by hue.
Version: 1.0.2
Version: 1.1.0
Author: Reyhoun
Author URI: http://reyhoun.com/
License: GPLv2 or later
Expand Down
6 changes: 6 additions & 0 deletions readme.txt
Expand Up @@ -28,5 +28,11 @@ This ACF field type is compatible with:

== Changelog ==

= 1.1.0 =
* Add saturate and Lightness default value
* Bug fix: Hue Label
* bug fix: load more than a field
* bug fix: 0 value

= 1.0.0 =
* Initial Release.

0 comments on commit 3198e04

Please sign in to comment.