Superman allegedly gets his powers from "our yellow sun" (feel free to correct me on that as I'm a Superman newbie, but that was the impression I had). Has he ever been attacked by someone attempting to change the colour/nature of our sun to remove his powers?
Yes, though the attack wasn't directed specifically at Superman. The Post-Crisis storyline "The Final Night" deals with a story where the sun is under attack by a creature called the Sun-Eater. Superman is affected as his powers are slowly diminished by the loss of the sun.
The pedigree of this award-winning story is quite complicated:
- The Pre-Crisis Legion of Superheroes had a storyline where an alien weapon called the Sun-Eater was unleashed on the Earth sun in the 30th century.
A Sun-Eater is a living nebula with the ability to drain whole stars of all their energy; this snuffs out the star and causes its solar system to freeze (and all living beings in it to die). The Sun-Eaters were created by the alien race known as Controllers as a way to destroy entire worlds that they judged to be too "evil." Each Sun-Eater was kept in a dormant state until needed, watched over by a Controller.
- The Legion saga which was much beloved during that era eventually led to the Sun-Eater being defeated by Ferro Lad. The Sun Eater needed to be destroyed by flying an Absorbatron Bomb into it to kill it. Superboy couldn't do it after being exposed to red sun radiation already within the Sun Eater.
Ferro Lad was capable of delivering the bomb but died in the attempt. I confused this with an equally epic story in Superboy and the Legion of Superheroes #251 where Matter Eater Lad was forced to consume a device called the Miracle Machine in order to save the Earth. He was driven insane in the process.
Suffice it to say, the nostalgia-machine was activated during a period of Post-Crisis ennui and someone decided to revive that story for the 20th Century Earth and have a Sun-Eater come and attack the sun of our period.
During this time, Superman is living on borrowed rations while his powers are slowly reduced by the Sun-Eater blocking the sun. It is a decent story, but it goes on a bit long for my taste.
The Yellow Sun explanation is one of many explanations that have been used.
Originally, his powers came from his alien heritage, Krypton had gravity many dozens of times stronger than Earth's, and since his species had evolved for that, he was much stronger than anyone on Earth (and could jump higher, was tougher, etc).
In the Silver Age of Comics, many ridiculous things happened. Superboy used 'Superweaving', Krypto the Superdog appeared, and practically any evil plot would happen.
Jimmy Olsen was taken to many other planets (most of which had blue or red suns) and gained super powers a LOT.
That said, I don't recall a specific plot where the color of our sun was changed - it wouldn't be likely anyway, since that would (under the loosly-defined 'rules' they had set up) grant everyone else on Earth superpowers.
I don't recall any plot of this nature in standard DC comic series.
However, depending on how far you're willing to stretch, it was the plot of the first half of season nine of Smallville. Briefly, a bunch of former Kandorian military led by "Major" Zod are released, but without any typical powers of Kryptonians on Earth. They eventually learn that Jor-El had somehow reversed their genetics before they were sent to Earth so the yellow sun dampened their powers. (Apparently, every Kryptonian knows that they should have powers under a yellow sun.)
Lois is sent into the future where she sees that Zod has built a tower that somehow filters the atmosphere to change the yellow sun to a red one, simultaneously giving the Kandorians super powers and stripping Clark's from him, thus allowing them to conquer the planet. Clark prevents that future by destroying the tower before it can go online, but it is definitely seen that it would have worked.
This is really stretching it, but on the Superfriends TV series, there's one chapter ("Lex Luthor Strikes Back") when Lex Luthor forms an alliance with demons from the sun to defeat the Superfriends. These demons make the sun red, and Superman becomes powerless almost immediately.
But I wouldn't consider Super Friends to be canon.
In Superman: War of Supermen comic series, Luthor made our yellow sun red to attack all of Supermen...
While battling the evil alien Brainiac, Superman & Supergirl discovered the long-lost bottled city of Kandor which was stolen from Krypton prior to its destruction. Superman re-enlarged the city on Earth, but it wasn't welcomed by Humans. Humans assaulted the city in which Kryptonian's leader Zor-El (Supergirl's father) was killed. Using highly evolved science, Alura (Zor-El's wife) created a new planet "New Krypton". Plus, she, as a new leader, freed General Zod from Phantom Zone to command new super military of New Krypton (every kryptonians had super powers due to yellow sun).
While New Krypton & Earth were at cold war, Zod ordered his military to attack Earth. When military was in space, Sam Lane (Lois Lane's father) destroyed New Krypton by a trick making their race extinct again. Kryptonian military successfully crushed Earth's Mars defense facility & they headed towards Earth.
When they were about to enter atmosphere of Earth:
The closest thing I can think of didn't involve Superman, but did involve the planet Daxam. Krypton was said to be a colony of Daxam, so Daxamites have the same reaction to a yellow sun.
In the "Great Darkness Saga" in the Legion of Super-Heroes, Darkseid exchanged the planet Daxam with the planet Apokolips. Apokolips orbited a yellow sun.
By this technique, Darkseid created an entire planet of Supermen.