Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

438
Visualizações
How to change the tui-color-picker default color using @toast-ui/react-image-editor?

I'm using the https://ui.toast.com/tui-image-editor library for a image edition functionality, there's a color picker component that comes by default there, I'm trying to change the default color of this color-picker but I can't find a way to do that, I've done some research and looks like this image-editor is using https://github.com/nhn/tui.color-picker as a dependency, so that may be way it's so hard to change the color.

Here's my code:

 <ImageEditor ref={this.editorRef} {...imageEditorOptions} 
            includeUI={{
              loadImage: {'image-path'},
              theme: myTheme,
              menu: ['text'],
              initMenu: 'text',
              menuBarPosition: 'bottom',
            }}
            selectionStyle={{
              cornerSize: 20,
              rotatingPointOffset: 70,
            }}
        />

On the "myTheme" variable I've setup some configurations for the color-pick style, but they haven't been working for setting its default color, probably because it's setup dynamically.

'colorpicker.button.border': '1px solid #1e1e1e',
'colorpicker.title.color': '#fff'

I've also tried setting up the color directly on my page CSS

.tui-image-editor-container .tui-image-editor-main-container {
    bottom: 0 !important;
    top: 0 !important;
    max-height: 450px;
    background-color: red !important;
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

there is currently no option to change the default colors of the color picker, refer here: https://github.com/nhn/tui.image-editor/issues/258

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

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda