Skip to content

Conversation

@Salvialf
Copy link
Contributor

Fixes #3155

@Salvialf Salvialf linked an issue Dec 14, 2025 that may be closed by this pull request
jeedom.cmd.displayDuration(_options.valueDate, cmd.querySelector('.timeCmd'), '#time#')
}
cmd.querySelector('.action_colorpicker_change').value = (_options.display_value != '') ? _options.display_value.substr(0, 7) : '#000000'
if (_options.display_value.length == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function toColor(value) {
        if (value.length == 0) {
            return '#000000'
        }
        if (value.startsWith('#')) { 
           return value.substr(0, 7)
        }

        return  '#' + value.substr(0, 6)
}
cmd.querySelector('.action_colorpicker_change').value = toColor(_options.display_value)

Copy link
Contributor Author

@Salvialf Salvialf Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think this approach is appropriate. First, the function would end up duplicated across every color picker widget. In addition, none of the other widgets rely on integrated global functions, so introducing one here would be inconsistent with the existing design.

@Salvialf Salvialf merged commit 5b68a44 into 4.5.1 Dec 16, 2025
@Salvialf Salvialf deleted the 3155-improve-color-picker-widget branch December 16, 2025 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve color picker widget

5 participants