Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default tool colors #258

Open
DaveSweeton opened this issue Oct 22, 2019 · 10 comments · Fixed by xea-xray/tui.image-editor#2
Open

Change default tool colors #258

DaveSweeton opened this issue Oct 22, 2019 · 10 comments · Fixed by xea-xray/tui.image-editor#2
Labels
Enhancement Enhance performance or improve usability of original features. Need Discussion Need discussion or investigation

Comments

@DaveSweeton
Copy link

DaveSweeton commented Oct 22, 2019

Version

3.7.0

Development Environment

Firefox, Windows

Current Behavior

The default colors for tools like text and draw shape that allow users to draw are hard coded.

E.g. tui.image-editor/src/js/ui/text.js line 33 hard codes the color as #ffbb3b.

Expected Behavior

I would like an option to override all of the default colors.

I can change colors for programmatic drawing operations, but I want to change the defaults for user drawing operations.

@junghwan-park
Copy link
Member

@DaveSweeton Thank you for recommendation. I'll consider adding 'defaultColor' option with my team.

@CremaLuca
Copy link

I'd need this too

@jinwoo-kim-nhn jinwoo-kim-nhn added the Enhancement Enhance performance or improve usability of original features. label Jan 10, 2020
@junghwan-park junghwan-park added Need Discussion Need discussion or investigation and removed Question labels Jan 10, 2020
@A113n1003
Copy link

A113n1003 commented Mar 30, 2020

also need,so do we have a schedule or it's already on some dev branch?

@marioviana
Copy link

This is something that makes sense for us too, this is going forward?

@Romain-Boudot
Copy link

Do we have news about this issue?

phwiget added a commit to phwiget/tui.image-editor that referenced this issue Sep 16, 2020
override default values for "draw", "shape", "icon" and "text" when used with UI
@phwiget
Copy link

phwiget commented Sep 16, 2020

Hi there,
just proposed this functionality in pull request #452

Usage:

var imageEditor = new tui.ImageEditor('#tui-image-editor-container', {
             includeUI: {
                 loadImage: {
                     path: 'img/sampleImage2.png',
                     name: 'SampleImage'
                 },
                 theme: blackTheme, // or whiteTheme
                 initMenu: 'filter',
                 menuBarPosition: 'bottom',
                 draw: {
                     color: '#00a9ff',
                     opacity: 1.0,
                     range: {
                         value: 8
                     }
                 },
                 text : {
                     color: '#00a9ff',
                     range: {
                         value: 28
                     }

                 },
                 icon : {
                     color: '#00a9ff'
                 },
                 shape : {
                     stroke: '#00a9ff'
                 }
             },
             cssMaxWidth: 700,
             cssMaxHeight: 500,
             usageStatistics: false
         });

Hope this helps!

xea-xray added a commit to xea-xray/tui.image-editor that referenced this issue Oct 28, 2020
feat: default value for ui-tools (nhn#258)
@joaquinabenza
Copy link

I also need this feature

@PQALAB
Copy link

PQALAB commented May 25, 2021

I found a workaround, I'm using the react library and loading the image when my component mounts. Within that action I found out you can set the values then "activate" the menu.

editor is a react ref but you should be able to get it with plain JS too.

var editor = this.editorRef.current.imageEditorInst
editor.ui.shape.options.stroke = "#ff0000"
editor.ui.shape._els.strokeColorpicker._color = "#ff0000"
editor.ui.shape.colorPickerControls[1].colorElement.style.backgroundColor = "#ff0000"
editor.ui.text.colorPickerInputBox.defaultValue = "#ff0000"
editor.ui.text._els.color = "#ff0000"
editor.ui.text._els.textColorpicker.color = "#ff0000"
editor.ui.text._els.textColorpicker.colorElement.style.backgroundColor = "#ff0000"
editor.ui.activeMenuEvent()```

@devhemmy
Copy link

a workaround this, is to make use of the startDrawingMode method

so you can create your own color picker or use the tui color picker and then invoke the StartDrawingMode method using your own function, here is how I do it in Vue (Nuxt.js)

<MyColorPicker @colorPicked="startDrawing" />

<tui-image-editor ref="imageEditor">
</tui-image-editor>

startDrawing({ color, drawStyle, size }) {
      this.$refs.imageEditor.invoke('stopDrawingMode')
      this.$refs.imageEditor.invoke('startDrawingMode', drawStyle, {
        width: size,
        color,
      })
    }

drawStyle can be 'FREE_DRAWING' or 'LINE_DRAWING'

this code is in Vue (Nuxt.js) but I believe it is fairly similar it React

@fa-sibasis-behera
Copy link

@junghwan-park Any update regarding to set the default color for drawing and other menu items ,for example initMenu.
We are expecting a solution like this format initColor: ' ' .
It would be really appreciated if we get a solution as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Enhance performance or improve usability of original features. Need Discussion Need discussion or investigation
Projects
None yet
Development

Successfully merging a pull request may close this issue.