In the large bowl, toss the shredded cabbage and onions. In the small saucepan, mix the sugar, vinegar, salt, and pepper. Bring to a boil and cook until the sugar dissolves. Add the oil and stir. Pour over the cabbage and toss gently. Serve warm or chill until ready to serve.