vue-color icon indicating copy to clipboard operation
vue-color copied to clipboard

How to apply color from color picker to an element?

Open kentforth opened this issue 4 years ago • 1 comments

I have a view where I use photoshop color picker:

<div class="color-picker">
     <photoshop-picker v-model="color"/>
</div>

I have an element where I want to change background color:

<textarea
	name="category-textarea"
        id="category-textarea"
	cols="30"
	rows="1"
        :style="{ backgroundColor: color }"
        ></textarea>

I imported it in script area like this:

<script>
import { Photoshop } from "vue-color";
export default {
	components: {"photoshop-picker": Photoshop },
	mounted() {},
	data() {
		return {
			color: "#7163E0"
		};
	}
};
</script>

How can I apply color from color picker to background color of textarea?

kentforth avatar Jun 16 '20 17:06 kentforth

try

:style="{ 'background-color': color; }"

(not tested)

hurradieweltgehtunter avatar Apr 28 '21 11:04 hurradieweltgehtunter