Led RGB

Hej. I have some trouble, with led RGB. How can I determine whether the Arduino is connected to a computer or not. I want switch off led when the computer is off

Not enough info yet. How is the Arduino powered? How is it connected to the computer? What kind of computer?

Arduino UNO. Connect to computer with USB, and also have a 12V in VIN pin. How can i detected when the cable is disconnected from my computer?

Send a message to the PC, have program running that can respond.

Add a jumper to USBVCC signal, read if it's high (PC connected) or low (PC not connected). Can connect jumper to the PTC resettable fuse.

Where can i find USBVCC in UNO?

http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf On the non-usb connector side of the PTC resettable polyfuse, the big green/gold part next to the USB connector, marked 501K.