You can use the pure javascript or jquery to achieve what you want. To do what you want you can use this functions
Find by tagname:
function getBackgroundByTagName(tag){
var color = $(tag).css('background-color');
console.log(color);
}
Find by class:
function getBackgroundByClassName(classname){
var color = $('.'+classname).css('background-color');
console.log(color);
}
Find by id
function getBackgroundById(idofelement){
var color = $('.'+idofelement).css('background-color');
console.log(color);
}
All you need to do is to run any of the functions and it will show the color in console.
Here's a start. This will get the background-colour
of the <body>
tag, whether it's inline
or in an external stylesheet
.
function getBackground() {
var getBody = document.getElementsByTagName("body")[0]
var prop = window.getComputedStyle(getBody).getPropertyValue("background-color");
if (prop === "transparent") {
console.log("No background colour set")
} else {
console.log(prop);
}
}
getBackground();
In theory you could use a canvas element to draw the web page into it and then examine a particular pixel to see what colour it was:
Using script you'd need to clone the contents of the page in question, and then paste it into a canvas element.
You could choose the coordinates with the mouse pointer, or you could simple hard code a specific pixel (in the corner of the page perhaps).
My website uses hashchange-triggered AJAX (to make it more bookmark-friendly). The problem I am having is that when I click "submit" in a form, all the form data that is serialize()'d to be sent via $....
My website uses hashchange-triggered AJAX (to make it more bookmark-friendly). The problem I am having is that when I click "submit" in a form, all the form data that is serialize()'d to be sent via $....
In the example below, map is called twice per onNext call which is unnecessary, because the same value for ds can be reused for the two observers. How to write the code such that the map is only ...
In the example below, map is called twice per onNext call which is unnecessary, because the same value for ds can be reused for the two observers. How to write the code such that the map is only ...
I am not able to set maximum height on the slider I am using, every height I set doesn't seem to be working. I have also tried setting the width on echo img row on the php part but it is not working. ...
I am not able to set maximum height on the slider I am using, every height I set doesn't seem to be working. I have also tried setting the width on echo img row on the php part but it is not working. ...
I have a lot of problems in my code because it is not synchronous. Here is an example of problem that i have in a chrome extension. This is my function function getTranslation(a_data, callback) { ...
I have a lot of problems in my code because it is not synchronous. Here is an example of problem that i have in a chrome extension. This is my function function getTranslation(a_data, callback) { ...