How to toggle cell color when clicking on that cell - google-sheets

I'm trying to find function that will change (toggle) cell color when you would click on it.
For example, I have cell that that only has number "1" on it and it's default color is white, so when I click that cell (like you would on click on a checkbox) the color should now be blue. If you would click it again, the color should go back to white etc.
What I tried so far:
Using Dta validation to change checkbox value to text so that both TRUE and FALSE statements simply are written as number 1, but I got validation error that both states couldn't be named the same
Using Conditional formatting. so when checkbox is checked, color of that cell is changed (this works to some degree, but for some reason not when I use it together with Data validation)
Does anyone have solution on how should I approach this?

In theory it could be possible with the onSelectionChange trigger on an apps script function. It could be a simple function that:
Gets the selected or active cell range
If the background color is white, changes it to blue
If the color is already blue, changes it back to white
Changing color is already doable with the setBackground function.

Related

sheet/cell color change when print sheet

Is there a way we can use conditional formatting like when user print sheet to pdf or printer it will change color of Cell or cells ?
Maybe add button to cell with "ctrl+p" key binding so when it is clicked it changes color of specific cell.

How to conditionally add a clickable checkbox in google-sheet?

I have tried:
=if(B11="","","☐")
But I wanted to add a clickable checkbox and not just the symbol.
Ok, so sheet does not have a way to hide/show validation checkboxes, but I did find a work-around.
Add the checkboxes via Data/Data Validation
Set the fill color to black
Set the text color to white
Now, set up conditional formatting using a custom formula
=C20=""
Set text color to none
Set fill color to white
I built a tab in this sheet call Checkboxes so you can make a copy and experiment. In this sheet I just added the checkboxes using the Insert/Checkbox instead of via Data/Data Validation
https://docs.google.com/spreadsheets/d/1qbLOjTdzISICTKyUp_jK6gZbQCt-OwtDYYy3HNJygeE/edit#gid=1995409740

Google Sheets - Applying Fill Colour to Several Individual Cells (without having to use dropdown menu)

Very very minor thing I find annoying and / or haven't figured out what I am doing wrong on Google Sheets.
In Excel, when you turn a cell a specific colour, it remembers the last colour you used, so you can click on the colour fill button and it will apply the same colour, rather than having to re-select it in the dropdown menu (see example screenshot of 'Excel').
In Google Sheets, the button shows the current colour of the cell (which I think is self-evident anyway), so I have to go into the drop down menu each time to select the new colour (see example screenshot of 'Sheets').
So my question is - is there a way for Google Sheets to retain the last colour used on the fill colour button?
What might be handy, is the format painter (Circled icon). Not perfect, but may save you 1 or more clicks. Just select the cell you want to copy the format, click on the format painter and click on the new cell or range (with control) you want to apply the format.
unfortunately no. in Google Sheets you always need to enter the color picker so this can be done by a minimum of two clicks
the only tool that remembers color is border color

Appcelerator ListView transparent row selection?

I've made an app (for iOS) that shows a ListView with product information on it.
On the left of the row, I have a button to add the product to the orderlist. However when I click the button, the entire row changes color. I don't want this, I want the row to stay the same when it is clicked.
I've tried to set the allowSelection property to 'false', but then the 'itemclick' event doesn't fire anymore, so that's not the solution.
I also tried to set the selectedBackgroundColor property to 'transparent', but this still changed the color of the row when the button is clicked.
Is there any easy solution to this? Thanks.
Use "selectionStyle" property of the cell class, example shown below,
cell.selectionStyle = .none
By this usage the selection will occur but it wont change the color on highlighting(selecting state) of the cell.

BlackBerry:List Field-How to Highlight only the text instead of the whole field

I have a list field displaying text, and I want only the text to display as focused when the field is selected. Instead of the whole field being highlighted in blue, I want only the text to be highlighted.
I have found methods to change the highlight color, but not how to limit the area being highlighted.
I haven't tried this, but you should be able to do just override drawFocus() to do nothing (that will get rid of the highlighting), and then in your drawListRow() check if the row is the selected row, and if that's the case draw the text a different color.

Resources